1 | <?php |
||
36 | class AdminController extends Controller { |
||
37 | /** @var IJobList */ |
||
38 | private $jobList; |
||
39 | /** @var ISecureRandom */ |
||
40 | private $secureRandom; |
||
41 | /** @var IConfig */ |
||
42 | private $config; |
||
43 | /** @var ITimeFactory */ |
||
44 | private $timeFactory; |
||
45 | /** @var UpdateChecker */ |
||
46 | private $updateChecker; |
||
47 | /** @var IL10N */ |
||
48 | private $l10n; |
||
49 | /** @var IDateTimeFormatter */ |
||
50 | private $dateTimeFormatter; |
||
51 | |||
52 | /** |
||
53 | * @param string $appName |
||
54 | * @param IRequest $request |
||
55 | * @param IJobList $jobList |
||
56 | * @param ISecureRandom $secureRandom |
||
57 | * @param IConfig $config |
||
58 | * @param ITimeFactory $timeFactory |
||
59 | * @param IL10N $l10n |
||
60 | * @param UpdateChecker $updateChecker |
||
61 | * @param IDateTimeFormatter $dateTimeFormatter |
||
62 | */ |
||
63 | public function __construct($appName, |
||
81 | |||
82 | /** |
||
83 | * Whether the instance is compatible with the updater |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | protected function isCompatibleWithUpdater() { |
||
88 | $updaterCompatible = true; |
||
89 | if(!function_exists('proc_open') || !function_exists('shell_exec')) { |
||
90 | $updaterCompatible = false; |
||
91 | } else { |
||
92 | $whichUnzip = shell_exec('command -v unzip'); |
||
93 | if(!class_exists('ZipArchive') && empty($whichUnzip)) { |
||
94 | $updaterCompatible = false; |
||
95 | } |
||
96 | |||
97 | $whichPhp = shell_exec('command -v php'); |
||
98 | if(empty($whichPhp)) { |
||
99 | $updaterCompatible = false; |
||
100 | } |
||
101 | } |
||
102 | if(!function_exists('curl_exec')) { |
||
103 | $updaterCompatible = false; |
||
104 | } |
||
105 | |||
106 | return $updaterCompatible; |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @return TemplateResponse |
||
111 | */ |
||
112 | public function displayPanel() { |
||
113 | $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime( |
||
114 | $this->config->getAppValue('core', 'lastupdatedat') |
||
115 | ); |
||
116 | |||
117 | $channels = [ |
||
118 | 'daily', |
||
119 | 'beta', |
||
120 | 'stable', |
||
121 | 'production', |
||
122 | ]; |
||
123 | $currentChannel = \OCP\Util::getChannel(); |
||
124 | // Remove the currently used channel from the channels list |
||
125 | if(($key = array_search($currentChannel, $channels)) !== false) { |
||
126 | unset($channels[$key]); |
||
127 | } |
||
128 | $updateState = $this->updateChecker->getUpdateState(); |
||
129 | $params = [ |
||
130 | 'isNewVersionAvailable' => ($updateState === []) ? false : true, |
||
131 | 'lastChecked' => $lastUpdateCheck, |
||
132 | 'currentChannel' => $currentChannel, |
||
133 | 'channels' => $channels, |
||
134 | 'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'], |
||
135 | 'updaterRequirementsFulfilled' => $this->isCompatibleWithUpdater(), |
||
136 | ]; |
||
137 | |||
138 | return new TemplateResponse($this->appName, 'admin', $params, ''); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @UseSession |
||
143 | * |
||
144 | * @param string $channel |
||
145 | * @return DataResponse |
||
146 | */ |
||
147 | public function setChannel($channel) { |
||
152 | |||
153 | /** |
||
154 | * @return DataResponse |
||
155 | */ |
||
156 | public function createCredentials() { |
||
167 | } |
||
168 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: