|
@@ -0,0 +1,71 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+/**
|
|
|
|
|
+ * 2016-04-06 by plabudda
|
|
|
|
|
+ *
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ini_set('max_execution_time', 300);
|
|
|
|
|
+ini_set('memory_limit', '512M');
|
|
|
|
|
+
|
|
|
|
|
+define('DS', DIRECTORY_SEPARATOR);
|
|
|
|
|
+define('APP_PATH_ROOT', dirname(__FILE__));
|
|
|
|
|
+define('APP_PATH_WWW', dirname(__FILE__));
|
|
|
|
|
+define('APP_PATH_CONFIG', APP_PATH_ROOT . DS . 'config');
|
|
|
|
|
+
|
|
|
|
|
+// set ini to log errors into error log file
|
|
|
|
|
+ini_set('display_startup_errors', '0');
|
|
|
|
|
+ini_set('log_errors', '1');
|
|
|
|
|
+ini_set('error_log', '/var/log/apache2/error_log');// TODO: php.ini ?
|
|
|
|
|
+
|
|
|
|
|
+require_once APP_PATH_ROOT . DS . 'se-lib' . DS . 'Lib.php';
|
|
|
|
|
+Lib::loadClass('V');
|
|
|
|
|
+Lib::loadClass('Config');
|
|
|
|
|
+Lib::loadClass('DB');
|
|
|
|
|
+Lib::loadClass('User');
|
|
|
|
|
+
|
|
|
|
|
+if (isset($_SERVER["argv"][1])) {
|
|
|
|
|
+ $_SERVER['SERVER_NAME'] = $_SERVER["argv"][1];
|
|
|
|
|
+}
|
|
|
|
|
+else if (empty($_SERVER["argv"]) && V::get('task', '', $_GET) == 'info') {
|
|
|
|
|
+ $info = array();
|
|
|
|
|
+ $info['max_execution_time'] = ini_get('max_execution_time');
|
|
|
|
|
+ $info['memory_limit'] = ini_get('memory_limit');
|
|
|
|
|
+ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">info (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($info);echo'</pre>';
|
|
|
|
|
+
|
|
|
|
|
+ ini_set('max_execution_time', 300);
|
|
|
|
|
+ ini_set('memory_limit', '512M');
|
|
|
|
|
+ $info = array();
|
|
|
|
|
+ $info['max_execution_time'] = ini_get('max_execution_time');
|
|
|
|
|
+ $info['memory_limit'] = ini_get('memory_limit');
|
|
|
|
|
+ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">info (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($info);echo'</pre>';
|
|
|
|
|
+}
|
|
|
|
|
+else {
|
|
|
|
|
+ die("\n The second argument should be server domain - e.g. biuro.biall-net.pl \n");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// TODO: check install
|
|
|
|
|
+Lib::loadClass('Router');
|
|
|
|
|
+$cronTaskName = 'checkInstall';
|
|
|
|
|
+$keyToken = 'bach_install_check';
|
|
|
|
|
+$token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, $cronTaskName, 300 * 10);
|
|
|
|
|
+$baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE";
|
|
|
|
|
+if ('biuro.biall-net.pl' == $_SERVER['SERVER_NAME']) $baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE/version-git";
|
|
|
|
|
+
|
|
|
|
|
+//file_get_contents("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=sendNofity");
|
|
|
|
|
+function runUrlTask($url) {
|
|
|
|
|
+ $ch = curl_init();
|
|
|
|
|
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
|
|
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
|
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
|
+ $return = curl_exec($ch);
|
|
|
|
|
+ curl_close($ch);
|
|
|
|
|
+ return $return;
|
|
|
|
|
+}
|
|
|
|
|
+$string = runUrlTask("{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task={$cronTaskName}}");
|
|
|
|
|
+echo "DBG: string -----------------------\n{$string}\nEOF string---------------------------------\n";
|
|
|
|
|
+
|
|
|
|
|
+die(".EOF - OK\n");
|
|
|
|
|
+
|
|
|
|
|
+?>
|