/** * Get a list of all created Cronjob models * * @param array $params */ public function actionStore($params) { if (!\GO::cronIsRunning()) { throw new \GO\Base\Exception\NoCron(); } $colModel = new \GO\Base\Data\ColumnModel(\GO\Base\Cron\CronJob::model()); $colModel->formatColumn('active', '$model->isRunning()?\\GO::t("running","cron"):$model->active'); $store = new \GO\Base\Data\DbStore('GO\\Base\\Cron\\CronJob', $colModel, $params); $store->defaultSort = 'name'; $response = $this->renderStore($store); echo $response; }
public static function runOnce() { if (!\GO::cronIsRunning()) { throw new \GO\Base\Exception\NoCron(); } $jobClass = get_called_class(); $job = new $jobClass(); $cron = new \GO\Base\Cron\CronJob(); $cron->name = $job->getLabel(); $cron->active = true; $cron->autodestroy = true; $cron->minutes = '*'; $cron->hours = '*'; $cron->monthdays = '*'; $cron->months = '*'; $cron->weekdays = '*'; $cron->job = $jobClass; if (!$cron->save()) { throw new Exception("Failed to save cron job '{$jobClass}'"); } return $cron; }
function test_system() { global $product_name; $tests = array(); $test['name'] = 'Operating System'; $test['showSuccessFeedback'] = false; $test['pass'] = strtolower(PHP_OS) === 'linux'; $test['feedback'] = 'Warning Your OS is "' . PHP_OS . '" The recommended OS is Linux. Other systems may work but are not officially supported'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Web server'; $test['showSuccessFeedback'] = false; $test['pass'] = stripos($_SERVER["SERVER_SOFTWARE"], 'apache') !== false; $test['feedback'] = "Warning, your web server " . $_SERVER["SERVER_SOFTWARE"] . " is not officially supported"; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'PHP SAPI mode'; $test['showSuccessFeedback'] = false; $test['pass'] = php_sapi_name() != 'apache'; $test['feedback'] = "Warning: PHP running in '" . php_sapi_name() . "' mode. This works fine but you need some additional rewrite rules for setting up activesync and CalDAV. See https://www.group-office.com/wiki/Z-push_2"; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Expose PHP'; $test['showSuccessFeedback'] = false; $test['pass'] = !ini_is_enabled('expose_php'); $test['feedback'] = 'Warning. You should set expose php to off to prevent version information to be public'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'PHP version'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('version_compare') && version_compare(phpversion(), "5.3", ">="); $test['feedback'] = 'Fatal error: Your PHP version is too old to run ' . $product_name . '. PHP 5.3 or higher is required'; $test['fatal'] = true; // $tests[]=$test; // $test['name']='Session Cookies'; // $test['pass']=ini_get('session.cookie_httponly')!=1; // $test['feedback']='Warning: session.cookie_httponly is set to 1. We recommend setting it to 0 because this can give problems with file uploads.'; // $test['fatal']=false; $tests[] = $test; $test['name'] = 'Output buffering'; $test['showSuccessFeedback'] = false; $test['pass'] = !ini_is_enabled('output_buffering'); $test['feedback'] = 'Warning: output_buffering is enabled. This will increase memory usage might cause memory errors'; $test['fatal'] = false; $tests[] = $test; //echo ini_get('mbstring.func_overload'); $test['name'] = 'mbstring function overloading'; $test['showSuccessFeedback'] = false; $test['pass'] = ini_get('mbstring.func_overload') < 1; $test['feedback'] = 'Warning: mbstring.func_overload is enabled in php.ini. Encrypting e-mail passwords will be disabled with this feature enabled. Disabling this feature is recommended'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Magic quotes setting'; $test['showSuccessFeedback'] = false; $test['pass'] = !get_magic_quotes_gpc(); $test['feedback'] = 'Warning: magic_quotes_gpc is enabled. You will get better performance if you disable this setting.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'MySQL support'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('mysqli_connect'); $test['feedback'] = 'Fatal error: The improved MySQL (MySQLi) extension is required. So is the MySQL server.'; $test['fatal'] = true; $tests[] = $test; $test['name'] = 'PDO support'; $test['showSuccessFeedback'] = false; $test['pass'] = class_exists('PDO') && extension_loaded('pdo_mysql'); $test['feedback'] = 'Fatal error: The PHP PDO extension with MySQL support is required.'; $test['fatal'] = true; $tests[] = $test; $test['name'] = 'Mcrypt support'; $test['showSuccessFeedback'] = false; $test['pass'] = extension_loaded('mcrypt'); $test['feedback'] = 'Warning: No Mcrypt extension for PHP found. Without mcrypt Group-Office has to save e-mail passwords in plain text.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'GD support'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('getimagesize'); $test['feedback'] = 'Warning: No GD extension for PHP found. Without GD Group-Office can\'t create thumbnails.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'pspell support'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('pspell_new'); $test['feedback'] = 'Warning: No pspell extension for PHP found. The spellchecker in the e-mail composer won\'t work.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'File upload support'; $test['showSuccessFeedback'] = false; $test['pass'] = ini_is_enabled('file_uploads'); $test['feedback'] = 'Warning: File uploads are disabled. Please set file_uploads=On in php.ini.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'File upload size'; $test['showSuccessFeedback'] = false; $test['pass'] = ini_return_bytes(ini_get('upload_max_filesize')) >= 20 * 1024 * 1024; $test['feedback'] = 'Warning: The upload_max_filesize php.ini value is lower than 20MB (' . ini_get('upload_max_filesize') . '). We recommend to settings this to at least 20MB'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Safe mode'; $test['showSuccessFeedback'] = false; $test['pass'] = !ini_is_enabled('safe_mode'); $test['feedback'] = 'Warning: safe_mode is enabled in php.ini. This may cause trouble with the filesystem module and Synchronization. If you can please set safe_mode=Off in php.ini'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Open base_dir'; $test['showSuccessFeedback'] = false; $test['pass'] = ini_get('open_basedir') == ''; $test['feedback'] = 'Warning: open_basedir is enabled. This may cause trouble with the filesystem module and Synchronization.'; $test['fatal'] = false; $tests[] = $test; // $test['name']='URL fopen'; // $test['pass']=ini_is_enabled('allow_url_fopen'); // $test['feedback']='Warning: allow_url_fopen is disabled in php.ini. RSS feeds on the start page will not work.'; // $test['fatal']=false; // $tests[]=$test; $test['name'] = 'Register globals'; $test['showSuccessFeedback'] = false; $test['pass'] = !ini_is_enabled('register_globals'); $test['feedback'] = 'Warning: register_globals is enabled in php.ini. This causes a problem in the spell checker and probably in some other parts. It\'s recommended to disable this.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'zlib compression'; $test['showSuccessFeedback'] = false; $test['pass'] = extension_loaded('zlib'); $test['feedback'] = 'Warning: No zlib output compression support. You can increase the initial load time by installing this php extension.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Calendar functions'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('easter_date'); $test['feedback'] = 'Warning: Calendar functions not available. The ' . $product_name . ' calendar won\'t be able to generate all holidays for you. Please compile PHP with --enable-calendar.'; $test['fatal'] = false; $memory_limit = return_bytes(ini_get('memory_limit')); $tests[] = $test; $test['name'] = 'Memory limit'; $test['showSuccessFeedback'] = false; $test['pass'] = $memory_limit >= 64 * 1024 * 1024; $test['feedback'] = 'Warning: Your memory limit setting (' . format_size($memory_limit) . ') is less than 64MB. It\'s recommended to allow at least 64 MB.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Error logging'; $test['showSuccessFeedback'] = false; $test['pass'] = ini_is_enabled('log_errors'); $test['feedback'] = 'Warning: PHP error logging is disabled in php.ini. It\'s recommended that this feature is enabled in a production environment.'; $test['fatal'] = false; /*$tests[]=$test; $test['name']='Error display'; $test['pass']=ini_get('display_errors')!='1'; $test['feedback']='Warning: PHP error display is enabled in php.ini. It\'s recommended that this feature is disabled because it can cause unnessecary interface crashes.'; $test['fatal']=false;*/ $tests[] = $test; $test['name'] = 'libwbxml'; $test['showSuccessFeedback'] = false; if (class_exists('GO')) { $wbxml2xml = whereis('wbxml2xml') ? whereis('wbxml2xml') : \GO::config()->cmd_wbxml2xml; $xml2wbxml = whereis('xml2wbxml') ? whereis('xml2wbxml') : \GO::config()->cmd_xml2wbxml; } else { $wbxml2xml = whereis('wbxml2xml') ? whereis('wbxml2xml') : '/usr/bin/wbxml2xml'; $xml2wbxml = whereis('xml2wbxml') ? whereis('xml2wbxml') : '/usr/bin/xml2wbxml'; } $test['pass'] = @is_executable($wbxml2xml) && @is_executable($xml2wbxml); $test['feedback'] = 'Warning: libwbxml2 is not installed. SyncML sync will not work!'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'DOM functions'; $test['showSuccessFeedback'] = false; $test['pass'] = class_exists('DOMDocument', false); $test['feedback'] = 'Warning: DOM functions are not installed. Synchronization with SyncML will not work. Install php-xml'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'MultiByte string functions'; $test['pass'] = function_exists('mb_detect_encoding'); $test['feedback'] = 'Warning: php-mbstring is not installed. Problems with non-ascii characters in e-mails and filenames might occur.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'TAR Compression'; $test['showSuccessFeedback'] = false; if (class_exists('GO')) { $tar = whereis('tar') ? whereis('tar') : \GO::config()->cmd_tar; } else { $tar = whereis('tar') ? whereis('tar') : '/bin/tar'; } $test['pass'] = @is_executable($tar); $test['feedback'] = 'Warning: tar is not installed or not executable.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'ZIP Compression'; $test['showSuccessFeedback'] = false; if (class_exists('GO')) { $zip = whereis('zip') ? whereis('zip') : \GO::config()->cmd_zip; } else { $zip = whereis('zip') ? whereis('zip') : '/usr/bin/zip'; } $test['pass'] = @is_executable($zip); $test['feedback'] = 'Warning: zip is not installed or not executable. Unpacking zip archives and using document templates for Microsoft Word and Open-Office.org won\'t be possible.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'TNEF'; $test['showSuccessFeedback'] = false; if (class_exists('GO')) { $tnef = whereis('tnef') ? whereis('tnef') : \GO::config()->cmd_tnef; } else { $tnef = whereis('tnef') ? whereis('tnef') : '/usr/bin/tnef'; } $test['pass'] = @is_executable($tnef); $test['feedback'] = 'Warning: tnef is not installed or not executable. you can\'t view winmail.dat attachments in the email module.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Ioncube enabled'; $test['pass'] = $ioncubeWorks = ioncube_tester(); $test['feedback'] = 'Warning: Ioncube is not installed. The professional modules will not be enabled.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Ioncube version check'; $testResultArray = ioncube_version_tester(); $test['showSuccessFeedback'] = true; $test['pass'] = $testResultArray['status'] == 'OK' ? true : false; $test['feedback'] = $testResultArray['problem'] . (!empty($testResultArray['problem']) ? ' - ' : '') . $testResultArray['solution']; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'JSON functions'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('json_encode'); $test['feedback'] = 'Fatal error: json_encode and json_decode functions are not available. Try apt-get install php5-json on Debian or Ubuntu.'; $test['fatal'] = true; $tests[] = $test; $ze1compat = ini_get('zend.ze1_compatibility_mode'); $test['name'] = 'zend.ze1_compatibility_mode'; $test['showSuccessFeedback'] = false; $test['pass'] = empty($ze1compat); $test['feedback'] = 'Fatal error: zend.ze1_compatibility_mode is enabled. ' . $product_name . ' can\'t run with this setting enabled'; $test['fatal'] = true; $tests[] = $test; $url = "http" . (!empty($_SERVER['HTTPS']) ? "s" : "") . "://" . $_SERVER['HTTP_HOST']; $headers = @get_headers($url . '/caldav'); $test['name'] = 'CalDAV alias'; $test['showSuccessFeedback'] = false; $test['pass'] = $headers && (strpos($headers[0], '401') !== false || strpos($headers[0], '200') !== false); $test['feedback'] = "Note: The alias /caldav was not detected. Please create: Alias /caldav /groupoffice/modules/caldav/calendar.php."; $test['fatal'] = false; $tests[] = $test; $headers = @get_headers($url . '/.well-known/caldav'); $test['name'] = 'CalDAV autodiscovery'; $test['showSuccessFeedback'] = false; $test['pass'] = $headers && (strpos($headers[0], '301') !== false || strpos($headers[0], '200') !== false); $test['feedback'] = "Note: The redirect /.well-known/caldav was not detected. Please create a redirect: Redirect 301 /.well-known/caldav /caldav"; $test['fatal'] = false; $tests[] = $test; $headers = @get_headers($url . '/carddav'); $test['name'] = 'CardDAV alias'; $test['showSuccessFeedback'] = false; $test['pass'] = $headers && (strpos($headers[0], '401') !== false || strpos($headers[0], '200') !== false); $test['feedback'] = "Note: The alias /carddav was not detected. Please create: Alias /carddav /groupoffice/modules/carddav/addressbook.php."; $test['fatal'] = false; $tests[] = $test; $headers = @get_headers($url . '/.well-known/carddav'); $test['name'] = 'CardDAV autodiscovery'; $test['showSuccessFeedback'] = false; $test['pass'] = $headers && (strpos($headers[0], '301') !== false || strpos($headers[0], '200') !== false); $test['feedback'] = "Note: The redirect /.well-known/carddav was not detected. Please create a redirect: Redirect 301 /.well-known/carddav /carddav"; $test['fatal'] = false; $tests[] = $test; $headers = @get_headers($url . '/Microsoft-Server-ActiveSync'); // var_dump($headers); $test['name'] = 'Microsoft-Server-ActiveSync alias'; $test['showSuccessFeedback'] = false; $test['pass'] = $headers && (strpos($headers[0], '401') !== false || strpos($headers[0], '200') !== false); $test['feedback'] = "Note: The alias /Microsoft-Server-ActiveSync was not detected. Please create: Alias /Microsoft-Server-ActiveSync /groupoffice/modules/z-push/index.php."; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Shared Memory Functions'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('sem_get') && function_exists('shm_attach') && function_exists('sem_acquire') && function_exists('shm_get_var'); $test['feedback'] = "InterProcessData::InitSharedMem(): PHP libraries for the use shared memory are not available. Z-push will work unreliably!"; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Process Control Extensions'; $test['showSuccessFeedback'] = false; $test['pass'] = function_exists('posix_getuid'); $test['feedback'] = "Process Control Extensions PHP library not avaialble. Z-push will work unreliably!"; $test['fatal'] = false; $tests[] = $test; if (class_exists('GO')) { // $test['name']='Writable license file'; // $test['pass']=GO::getLicenseFile()->exists() && GO::getLicenseFile()->isWritable(); // $test['feedback']="Fatal: the license file ".GO::getLicenseFile()->path()." is not writable. Please make it writable for the webserver."; // $test['fatal']=true; // // $tests[]=$test; $root = dirname(dirname(__FILE__)); if ($ioncubeWorks && is_dir($root . '/modules/professional')) { $test['name'] = 'Professional license'; $test['showSuccessFeedback'] = false; // if(!file_exists(GO::config()->root_path.'groupoffice-pro-'.\GO::config()->getMajorVersion().'-license.txt')){ // $test['feedback']='Warning: There\'s no license file "groupoffice-pro-'.\GO::config()->getMajorVersion().'-license.txt" in the root of Group-Office. The professional modules will not be enabled.'; // $test['fatal']=false; // $test['pass']=false; // }else if (!\GO::scriptCanBeDecoded('Professional')) { $test['feedback'] = 'Warning: Your professional license is invalid. The professional modules will not be enabled. Please contact Intermesh about this problem and supply the output of this page.'; $test['fatal'] = false; $test['pass'] = false; } else { $test['feedback'] = ''; $test['fatal'] = false; $test['pass'] = true; } $tests[] = $test; } if (\GO::isInstalled()) { $test['name'] = 'Protected files path'; $test['showSuccessFeedback'] = false; $test['pass'] = is_writable(\GO::config()->file_storage_path); $test['feedback'] = 'Fatal error: the file_storage_path setting in config.php is not writable. You must correct this or ' . $product_name . ' will not run.'; $test['fatal'] = false; $tests[] = $test; $test['name'] = 'Cronjob'; $test['showSuccessFeedback'] = false; $test['pass'] = GO::cronIsRunning(); $test['feedback'] = "Warning: The main cron job doesn't appear to be running. Please add a cron job: \n\n* * * * * www-data php " . \GO::config()->root_path . "groupofficecli.php -c=" . \GO::config()->get_config_file() . " -r=core/cron/run -q > /dev/null"; $test['fatal'] = false; $tests[] = $test; } } return $tests; }