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() : void { |
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() : void { |
17
|
1 |
|
$this->load->library('migration'); |
18
|
|
|
|
19
|
1 |
|
if(!$this->migration->current()) { |
|
|
|
|
20
|
|
|
show_error($this->migration->error_string()); |
|
|
|
|
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 series with new chapters. |
27
|
|
|
* Called via: public/index.php admin/update_series |
28
|
|
|
* |
29
|
|
|
* This is called via a cron job every 6 hours. |
30
|
|
|
* Series 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 updateSeries() { |
33
|
|
|
print 'Environment: ' . ENVIRONMENT . "\n"; |
34
|
|
|
|
35
|
|
|
// hack, just incase something happens |
36
|
|
|
if (!(date("Y-m-d") > '2019-08-01')) { |
37
|
|
|
$this->Tracker->admin->updateLatestChapters(); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Used to check for, and update titles with new chapters from a site following list. |
43
|
|
|
* Called via: public/index.php admin/update_series_custom |
44
|
|
|
* |
45
|
|
|
* This is called via a cron job every hour. |
46
|
|
|
* Series will always be updated if they can be. For more info see: https://github.com/DakuTree/manga-tracker/issues/78 |
47
|
|
|
* FIXME: The entire implementation of this is an utter mess. |
48
|
|
|
**/ |
49
|
|
|
public function updateSeriesCustom() { |
50
|
|
|
$this->Tracker->admin->updateCustom(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function refollowCustom() { |
54
|
|
|
$this->Tracker->admin->refollowCustom(); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function testSite($type, $site, $extra = NULL) { |
58
|
|
|
print "Testing site\n"; |
59
|
|
|
switch($type) { |
60
|
|
|
case 'update': |
61
|
|
|
if(!is_null($extra)) { |
62
|
|
|
print_r($this->Tracker->sites->{$site}->getTitleData($extra)); |
63
|
|
|
} |
64
|
|
|
break; |
65
|
|
|
|
66
|
|
|
case 'custom_update': |
67
|
|
|
print_r($this->Tracker->sites->{$site}->doCustomUpdate()); |
68
|
|
|
break; |
69
|
|
|
|
70
|
|
|
case 'force_update': |
71
|
|
|
print_r($this->Tracker->admin->updateAllTitlesBySite($site, $extra)); |
72
|
|
|
break; |
73
|
|
|
|
74
|
|
|
default: |
75
|
|
|
print "Missing parameters."; |
76
|
|
|
break; |
77
|
|
|
} |
78
|
|
|
print "\n"; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
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.