Completed
Push — master ( da8f3c...d8ce3e )
by Angus
03:49
created

AdminCLI   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
dl 0
loc 51
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0
wmc 7
lcom 2
cbo 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A index() 0 3 1
A migrate() 0 8 2
A updateTitles() 0 3 1
A updateTitlesCustom() 0 3 1
A test() 0 5 1
1
<?php defined('BASEPATH') OR exit('No direct script access allowed');
2
3
class AdminCLI extends CLI_Controller {
4 1
	public function __construct() {
5 1
		parent::__construct();
6 1
	}
7
8
	public function index() {
9
		print "ERROR: This is an invalid route";
10
	}
11
12
	/**
13
	 * Used to update the site migration version.
14
	 * Called via public/index.php admin/migrate
15
	 */
16 1
	public function migrate() {
17 1
		$this->load->library('migration');
18
19 1
		if(!$this->migration->current()) {
0 ignored issues
show
Bug introduced by
The method current() does not seem to exist on object<CI_Migration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
			show_error($this->migration->error_string());
0 ignored issues
show
Bug introduced by
The method error_string() does not seem to exist on object<CI_Migration>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
		}
22
		//TODO: Expand on this - http://avenir.ro/the-migrations-in-codeigniter-or-how-to-have-a-git-for-your-database/
23 1
	}
24
25
	/**
26
	 * Used to check for, and update titles with new chapters.
27
	 * Called via: public/index.php admin/update_titles
28
	 *
29
	 * This is called via a cron job every 6 hours.
30
	 * Titles are only checked if they haven't been updated in 16+ hours (unless they are marked as complete, to which they are only checked once a week).
31
	 */
32
	public function updateTitles() {
33
		$this->Tracker->updateLatestChapters();
34
	}
35
36
	/**
37
	 * Used to check for, and update titles with new chapters from a site following list.
38
	 * Called via: public/index.php admin/update_titles_custom
39
	 *
40
	 * This is called via a cron job every hour.
41
	 * Titles will always be updated if they can be. For more info see: https://github.com/DakuTree/manga-tracker/issues/78
42
	 * FIXME: The entire implementation of this is an utter mess.
43
	 **/
44
	public function updateTitlesCustom() {
45
		$this->Tracker->updateCustom();
46
	}
47
48
	public function test() {
49
		//print_r($this->Tracker->sites->{'GameOfScanlation'}->getTitleData('legendary-moonlight-sculptor.99'));
50
		//$this->Tracker->sites->{'Batoto'}->getTitleData('718:--:English', TRUE);
51
		$this->Tracker->sites->{'Batoto'}->doCustomUpdate();
52
	}
53
}
54