| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?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');
- Router::getRoute('Config')->reinstall();
- $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";
- {
- echo "Router::getRoute('FileStorage')->reinstall() ...\n";
- Router::getRoute('FileStorage')->reinstall();
- echo "\nRouter::getRoute('FileStorage')->reinstall() DONE\n";
- }
- die(".EOF - OK\n");
- ?>
|