/** * @deprecated 6.0.0 * creates a regular task * @param string $klass class name * @param string $method method name * @return boolean|null * @since 4.5.0 */ public static function addRegularTask($klass, $method) { if (!\OC::needUpgrade()) { self::registerJob('OC\\BackgroundJob\\Legacy\\RegularJob', array($klass, $method)); return true; } }
/** * @brief check if the current server configuration is suitable for ownCloud * @return array arrays with error messages and hints */ public static function checkServer() { $errors = array(); $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data'); if (!\OC::needUpgrade() && OC_Config::getValue('installed', false)) { // this check needs to be done every time $errors = self::checkDataDirectoryValidity($CONFIG_DATADIRECTORY); } // Assume that if checkServer() succeeded before in this session, then all is fine. if (\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) { return $errors; } $defaults = new \OC_Defaults(); $webServerRestart = false; //check for database drivers if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect') and !is_callable('oci_connect')) { $errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.', 'hint' => ''); $webServerRestart = true; } //common hint for all file permissions error messages $permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.'; // Check if config folder is writable. if (!is_writable(OC::$SERVERROOT . "/config/") or !is_readable(OC::$SERVERROOT . "/config/")) { $errors[] = array('error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.'); } // Check if there is a writable install folder. if (OC_Config::getValue('appstoreenabled', true)) { if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) { $errors[] = array('error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.'); } } // Create root dir. if (!is_dir($CONFIG_DATADIRECTORY)) { $success = @mkdir($CONFIG_DATADIRECTORY); if ($success) { $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); } else { $errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => 'This can usually be fixed by ' . '<a href="' . OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the root directory</a>.'); } } else { if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud', 'hint' => $permissionsHint); } else { $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); } } if (!OC_Util::isSetLocaleWorking()) { $errors[] = array('error' => 'Setting locale to en_US.UTF-8/fr_FR.UTF-8/es_ES.UTF-8/de_DE.UTF-8/ru_RU.UTF-8/pt_BR.UTF-8/it_IT.UTF-8/ja_JP.UTF-8/zh_CN.UTF-8 failed', 'hint' => 'Please install one of theses locales on your system and restart your webserver.'); } $moduleHint = "Please ask your server administrator to install the module."; // check if all required php modules are present if (!class_exists('ZipArchive')) { $errors[] = array('error' => 'PHP module zip not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!class_exists('DOMDocument')) { $errors[] = array('error' => 'PHP module dom not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('xml_parser_create')) { $errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('mb_detect_encoding')) { $errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('ctype_digit')) { $errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('json_encode')) { $errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!extension_loaded('gd') || !function_exists('gd_info')) { $errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('gzencode')) { $errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('iconv')) { $errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (!function_exists('simplexml_load_string')) { $errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (version_compare(phpversion(), '5.3.3', '<')) { $errors[] = array('error' => 'PHP 5.3.3 or higher is required.', 'hint' => 'Please ask your server administrator to update PHP to the latest version.' . ' Your PHP version is no longer supported by ownCloud and the PHP community.'); $webServerRestart = true; } if (!defined('PDO::ATTR_DRIVER_NAME')) { $errors[] = array('error' => 'PHP PDO module is not installed.', 'hint' => $moduleHint); $webServerRestart = true; } if (strtolower(@ini_get('safe_mode')) == 'on' || strtolower(@ini_get('safe_mode')) == 'yes' || strtolower(@ini_get('safe_mode')) == 'true' || ini_get("safe_mode") == 1) { $errors[] = array('error' => 'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => 'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'); $webServerRestart = true; } if (get_magic_quotes_gpc() == 1) { $errors[] = array('error' => 'Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.', 'hint' => 'Magic Quotes is a deprecated and mostly useless setting that should be disabled. ' . 'Please ask your server administrator to disable it in php.ini or in your webserver config.'); $webServerRestart = true; } if ($webServerRestart) { $errors[] = array('error' => 'PHP modules have been installed, but they are still listed as missing?', 'hint' => 'Please ask your server administrator to restart the web server.'); } $errors = array_merge($errors, self::checkDatabaseVersion()); // Cache the result of this function \OC::$session->set('checkServer_suceeded', count($errors) == 0); return $errors; }
/** * @deprecated * queues a task * @param string $app app name * @param string $class class name * @param string $method method name * @param string $parameters all useful data as text * @return int id of task */ public static function addQueuedTask($app, $class, $method, $parameters) { if (!\OC::needUpgrade()) { self::registerJob('OC\\BackgroundJob\\Legacy\\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters)); return true; } }