当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_App::getInstallPath方法代码示例

本文整理汇总了PHP中OC_App::getInstallPath方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getInstallPath方法的具体用法?PHP OC_App::getInstallPath怎么用?PHP OC_App::getInstallPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_App的用法示例。


在下文中一共展示了OC_App::getInstallPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeApp

 /**
  * Removes an app
  * @param string $name name of the application to remove
  * @param array $options options
  * @return boolean
  *
  * This function removes an app. $options is an associative array. The
  * following keys are optional:ja
  *   - keeppreferences: boolean, if true the user preferences won't be deleted
  *   - keepappconfig: boolean, if true the config will be kept
  *   - keeptables: boolean, if true the database will be kept
  *   - keepfiles: boolean, if true the user files will be kept
  *
  * This function works as follows
  *   -# including appinfo/remove.php
  *   -# removing the files
  *
  * The function will not delete preferences, tables and the configuration,
  * this has to be done by the function oc_app_uninstall().
  */
 public static function removeApp($name, $options = array())
 {
     if (isset($options['keeppreferences']) and $options['keeppreferences'] == false) {
         // todo
         // remove preferences
     }
     if (isset($options['keepappconfig']) and $options['keepappconfig'] == false) {
         // todo
         // remove app config
     }
     if (isset($options['keeptables']) and $options['keeptables'] == false) {
         // todo
         // remove app database tables
     }
     if (isset($options['keepfiles']) and $options['keepfiles'] == false) {
         // todo
         // remove user files
     }
     if (OC_Installer::isDownloaded($name)) {
         $appdir = OC_App::getInstallPath() . '/' . $name;
         OC_Helper::rmdirr($appdir);
         return true;
     } else {
         OC_Log::write('core', 'can\'t remove app ' . $name . '. It is not installed.', OC_Log::ERROR);
         return false;
     }
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:47,代码来源:installer.php

示例2: checkServer

	/**
	 * check if the current server configuration is suitable for ownCloud
	 *
	 * @param \OCP\IConfig $config
	 * @return array arrays with error messages and hints
	 */
	public static function checkServer(\OCP\IConfig $config) {
		$l = \OC::$server->getL10N('lib');
		$errors = array();
		$CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');

		if (!self::needUpgrade($config) && $config->getSystemValue('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::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
			return $errors;
		}

		$webServerRestart = false;
		$setup = new OC_Setup($config);
		$availableDatabases = $setup->getSupportedDatabases();
		if (empty($availableDatabases)) {
			$errors[] = array(
				'error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'),
				'hint' => '' //TODO: sane hint
			);
			$webServerRestart = true;
		}

		//common hint for all file permissions error messages
		$permissionsHint = $l->t('Permissions can usually be fixed by '
			. '%sgiving the webserver write access to the root directory%s.',
			array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));

		// Check if config folder is writable.
		if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
			$errors[] = array(
				'error' => $l->t('Cannot write into "config" directory'),
				'hint' => $l->t('This can usually be fixed by '
					. '%sgiving the webserver write access to the config directory%s.',
					array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
			);
		}

		// Check if there is a writable install folder.
		if ($config->getSystemValue('appstoreenabled', true)) {
			if (OC_App::getInstallPath() === null
				|| !is_writable(OC_App::getInstallPath())
				|| !is_readable(OC_App::getInstallPath())
			) {
				$errors[] = array(
					'error' => $l->t('Cannot write into "apps" directory'),
					'hint' => $l->t('This can usually be fixed by '
						. '%sgiving the webserver write access to the apps directory%s'
						. ' or disabling the appstore in the config file.',
						array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'))
				);
			}
		}
		// Create root dir.
		if ($config->getSystemValue('installed', false)) {
			if (!is_dir($CONFIG_DATADIRECTORY)) {
				$success = @mkdir($CONFIG_DATADIRECTORY);
				if ($success) {
					$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
				} else {
					$errors[] = array(
						'error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)),
						'hint' => $l->t('This can usually be fixed by '
							. '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.',
							array(OC_Helper::linkToDocs('admin-dir_permissions')))
					);
				}
			} 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' => $l->t('Setting locale to %s failed',
					array('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')),
				'hint' => $l->t('Please install one of these locales on your system and restart your webserver.')
			);
		}

		// Contains the dependencies that should be checked against
		// classes = class_exists
		// functions = function_exists
		// defined = defined
		// If the dependency is not found the missing module name is shown to the EndUser
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:util.php

示例3: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::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::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $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' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     //common hint for all file permissions error messages
     $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</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' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // 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' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
         }
     } 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' => $l->t('Setting locale to %s failed', array('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')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // If the dependency is not found the missing module name is shown to the EndUser
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom'), 'functions' => array('xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML'), 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'));
     $missingDependencies = array();
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     foreach ($dependencies['classes'] as $class => $module) {
         if (!class_exists($class)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['functions'] as $function => $module) {
         if (!function_exists($function)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($dependencies['defined'] as $defined => $module) {
         if (!defined($defined)) {
             $missingDependencies[] = $module;
         }
     }
     foreach ($missingDependencies as $missingDependency) {
         $errors[] = array('error' => $l->t('PHP module %s not installed.', array($missingDependency)), 'hint' => $moduleHint);
         $webServerRestart = true;
     }
     if (version_compare(phpversion(), '5.3.3', '<')) {
         $errors[] = array('error' => $l->t('PHP %s or higher is required.', '5.3.3'), 'hint' => $l->t('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 (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' => $l->t('PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('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' => $l->t('Magic Quotes is enabled. ownCloud requires that it is disabled to work properly.'), 'hint' => $l->t('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 (!self::isAnnotationsWorking()) {
         $errors[] = array('error' => 'PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.', 'hint' => 'This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.');
     }
     if ($webServerRestart) {
         $errors[] = array('error' => $l->t('PHP modules have been installed, but they are still listed as missing?'), 'hint' => $l->t('Please ask your server administrator to restart the web server.'));
     }
     $errors = array_merge($errors, self::checkDatabaseVersion());
//.........这里部分代码省略.........
开发者ID:pinoniq,项目名称:core,代码行数:101,代码来源:util.php

示例4: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  *
  * @param \OCP\IConfig $config
  * @return array arrays with error messages and hints
  */
 public static function checkServer(\OCP\IConfig $config)
 {
     $l = \OC::$server->getL10N('lib');
     $errors = array();
     $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');
     if (!self::needUpgrade($config) && $config->getSystemValue('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::$server->getSession()->exists('checkServer_succeeded') && \OC::$server->getSession()->get('checkServer_succeeded')) {
         return $errors;
     }
     $webServerRestart = false;
     $setup = new \OC\Setup($config, \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom());
     $availableDatabases = $setup->getSupportedDatabases();
     if (empty($availableDatabases)) {
         $errors[] = array('error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '');
         $webServerRestart = true;
     }
     // Check if server running on Windows platform
     if (OC_Util::runningOnWindows()) {
         $errors[] = ['error' => $l->t('Microsoft Windows Platform is not supported'), 'hint' => $l->t('Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you ' . 'use a Linux server in a virtual machine if you have no option for migrating the server itself. ' . 'Find Linux packages as well as easy to deploy virtual machine images on <a href="%s">%s</a>. ' . 'For migrating existing installations to Linux you can find some tips and a migration script ' . 'in <a href="%s">our documentation</a>.', ['https://owncloud.org/install/', 'owncloud.org/install/', 'https://owncloud.org/?p=8045'])];
     }
     // Check if config folder is writable.
     if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
         $errors[] = array('error' => $l->t('Cannot write into "config" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the config directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
     }
     // Check if there is a writable install folder.
     if ($config->getSystemValue('appstoreenabled', true)) {
         if (OC_App::getInstallPath() === null || !is_writable(OC_App::getInstallPath()) || !is_readable(OC_App::getInstallPath())) {
             $errors[] = array('error' => $l->t('Cannot write into "apps" directory'), 'hint' => $l->t('This can usually be fixed by ' . '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')));
         }
     }
     // Create root dir.
     if ($config->getSystemValue('installed', false)) {
         if (!is_dir($CONFIG_DATADIRECTORY)) {
             $success = @mkdir($CONFIG_DATADIRECTORY);
             if ($success) {
                 $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
             } else {
                 $errors[] = array('error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'hint' => $l->t('This can usually be fixed by ' . '<a href="%s" target="_blank">giving the webserver write access to the root directory</a>.', array(OC_Helper::linkToDocs('admin-dir_permissions'))));
             }
         } else {
             if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
                 //common hint for all file permissions error messages
                 $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
                 $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' => $l->t('Setting locale to %s failed', array('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')), 'hint' => $l->t('Please install one of these locales on your system and restart your webserver.'));
     }
     // Contains the dependencies that should be checked against
     // classes = class_exists
     // functions = function_exists
     // defined = defined
     // ini = ini_get
     // If the dependency is not found the missing module name is shown to the EndUser
     // When adding new checks always verify that they pass on Travis as well
     // for ini settings, see https://github.com/owncloud/administration/blob/master/travis-ci/custom.ini
     $dependencies = array('classes' => array('ZipArchive' => 'zip', 'DOMDocument' => 'dom', 'XMLWriter' => 'XMLWriter'), 'functions' => ['xml_parser_create' => 'libxml', 'mb_detect_encoding' => 'mb multibyte', 'ctype_digit' => 'ctype', 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML', 'hash' => 'HASH Message Digest Framework', 'curl_init' => 'cURL'], 'defined' => array('PDO::ATTR_DRIVER_NAME' => 'PDO'), 'ini' => ['default_charset' => 'UTF-8']);
     $missingDependencies = array();
     $invalidIniSettings = [];
     $moduleHint = $l->t('Please ask your server administrator to install the module.');
     /**
      * FIXME: The dependency check does not work properly on HHVM on the moment
      *        and prevents installation. Once HHVM is more compatible with our
      *        approach to check for these values we should re-enable those
      *        checks.
      */
     $iniWrapper = \OC::$server->getIniWrapper();
     if (!self::runningOnHhvm()) {
         foreach ($dependencies['classes'] as $class => $module) {
             if (!class_exists($class)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['functions'] as $function => $module) {
             if (!function_exists($function)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['defined'] as $defined => $module) {
             if (!defined($defined)) {
                 $missingDependencies[] = $module;
             }
         }
         foreach ($dependencies['ini'] as $setting => $expected) {
             if (is_bool($expected)) {
                 if ($iniWrapper->getBool($setting) !== $expected) {
//.........这里部分代码省略.........
开发者ID:reverserob,项目名称:core,代码行数:101,代码来源:util.php

示例5: scriptwrapper

 /**
  * This is a wrapper for retrieve 3rd party scripts.
  * 
  * @param string $name The 3rd'party script to return.
  * 
  * @return DataResponse|JSONResponse
  * 
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function scriptwrapper($name)
 {
     $app_dir = \OC_App::getInstallPath() . DIRECTORY_SEPARATOR . 'secure_container' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . '3rdparty' . DIRECTORY_SEPARATOR;
     $content = '';
     $wrapper_function = 'js_wrapper';
     $wrapper_code = '';
     switch (strtolower($name)) {
         case 'sjcl':
             $file = $app_dir . 'sjcl' . DIRECTORY_SEPARATOR . 'sjcl.js';
             $content = file_get_contents($file);
             $wrapper_function = 'OC_SJCL';
             $wrapper_code = 'this.sjcl = sjcl;';
             break;
         default:
             $content = '';
     }
     $response = 'function __' . $wrapper_function . '() { ' . $content . chr(10) . $wrapper_code . ' }' . chr(10);
     $response .= 'var ' . $wrapper_function . ' = new __' . $wrapper_function . '();';
     return new ScriptResponse($response);
 }
开发者ID:kjuanman,项目名称:oc_SecureContainer,代码行数:30,代码来源:pagecontroller.php

示例6: checkServer

 /**
  * @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')) {
//.........这里部分代码省略.........
开发者ID:hjimmy,项目名称:owncloud,代码行数:101,代码来源:util.php

示例7: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $errors = array();
     $web_server_restart = false;
     //check for database drivers
     if (!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')) {
         $errors[] = array('error' => 'No database drivers (sqlite, mysql, or postgresql) installed.<br/>', 'hint' => '');
         //TODO: sane hint
         $web_server_restart = true;
     }
     //common hint for all file permissons error messages
     $permissionsHint = "Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";
     // 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 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud");
     }
     // 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' => "You can usually fix this by giving the webserver user write access to the apps directory\n\t\t\t\tin owncloud or disabling the appstore in the config file.");
         }
     }
     $CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     //check for correct file permissions
     if (!stristr(PHP_OS, 'WIN')) {
         $permissionsModHint = "Please change the permissions to 0770 so that the directory cannot be listed by other users.";
         $prems = substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
         if (substr($prems, -1) != '0') {
             OC_Helper::chmodr($CONFIG_DATADIRECTORY, 0770);
             clearstatcache();
             $prems = substr(decoct(@fileperms($CONFIG_DATADIRECTORY)), -3);
             if (substr($prems, 2, 1) != '0') {
                 $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') is readable for other users<br/>', 'hint' => $permissionsModHint);
             }
         }
         if (OC_Config::getValue("enablebackup", false)) {
             $CONFIG_BACKUPDIRECTORY = OC_Config::getValue("backupdirectory", OC::$SERVERROOT . "/backup");
             $prems = substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
             if (substr($prems, -1) != '0') {
                 OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY, 0770);
                 clearstatcache();
                 $prems = substr(decoct(@fileperms($CONFIG_BACKUPDIRECTORY)), -3);
                 if (substr($prems, 2, 1) != '0') {
                     $errors[] = array('error' => 'Data directory (' . $CONFIG_BACKUPDIRECTORY . ') is readable for other users<br/>', 'hint' => $permissionsModHint);
                 }
             }
         }
     } else {
         //TODO: permissions checks for windows hosts
     }
     // Create root dir.
     if (!is_dir($CONFIG_DATADIRECTORY)) {
         $success = @mkdir($CONFIG_DATADIRECTORY);
         if (!$success) {
             $errors[] = array('error' => "Can't create data directory (" . $CONFIG_DATADIRECTORY . ")", 'hint' => "You can usually fix this by giving the webserver write access to the ownCloud directory '" . OC::$SERVERROOT . "' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
         }
     } else {
         if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
             $errors[] = array('error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud<br/>', 'hint' => $permissionsHint);
         }
     }
     // check if all required php modules are present
     if (!class_exists('ZipArchive')) {
         $errors[] = array('error' => 'PHP module zip not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('mb_detect_encoding')) {
         $errors[] = array('error' => 'PHP module mb multibyte not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('ctype_digit')) {
         $errors[] = array('error' => 'PHP module ctype is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('json_encode')) {
         $errors[] = array('error' => 'PHP module JSON is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('imagepng')) {
         $errors[] = array('error' => 'PHP module GD is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('gzencode')) {
         $errors[] = array('error' => 'PHP module zlib is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('iconv')) {
         $errors[] = array('error' => 'PHP module iconv is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('simplexml_load_string')) {
         $errors[] = array('error' => 'PHP module SimpleXML is not installed.<br/>', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (floatval(phpversion()) < 5.3) {
         $errors[] = array('error' => 'PHP 5.3 is required.<br/>', 'hint' => 'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
//.........这里部分代码省略.........
开发者ID:ryanshoover,项目名称:core,代码行数:101,代码来源:util.php

示例8: installApp


//.........这里部分代码省略.........
		if(!is_file($extractDir.'/appinfo/info.xml')) {
			//try to find it in a subdir
			$dh=opendir($extractDir);
			while($folder=readdir($dh)) {
				if($folder[0]!='.' and is_dir($extractDir.'/'.$folder)) {
					if(is_file($extractDir.'/'.$folder.'/appinfo/info.xml')) {
						$extractDir.='/'.$folder;
					}
				}
			}
		}
		if(!is_file($extractDir.'/appinfo/info.xml')) {
			OC_Log::write('core', 'App does not provide an info.xml file', OC_Log::ERROR);
			OC_Helper::rmdirr($extractDir);
			if($data['source']=='http') {
				unlink($path);
			}
			return false;
		}
		$info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true);
		// check the code for not allowed calls
		if(!OC_Installer::checkCode($info['id'], $extractDir)) {
			OC_Log::write('core', 'App can\'t be installed because of not allowed code in the App', OC_Log::ERROR);
			OC_Helper::rmdirr($extractDir);
			return false;
		}

		// check if the app is compatible with this version of ownCloud
		$version=OC_Util::getVersion();
		if(!isset($info['require']) or ($version[0]>$info['require'])) {
			OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR);
			OC_Helper::rmdirr($extractDir);
			return false;
		}

		//check if an app with the same id is already installed
		if(self::isInstalled( $info['id'] )) {
			OC_Log::write('core', 'App already installed', OC_Log::WARN);
			OC_Helper::rmdirr($extractDir);
			if($data['source']=='http') {
				unlink($path);
			}
			return false;
		}

		$basedir=OC_App::getInstallPath().'/'.$info['id'];
		//check if the destination directory already exists
		if(is_dir($basedir)) {
			OC_Log::write('core', 'App directory already exists', OC_Log::WARN);
			OC_Helper::rmdirr($extractDir);
			if($data['source']=='http') {
				unlink($path);
			}
			return false;
		}

		if(isset($data['pretent']) and $data['pretent']==true) {
			return false;
		}

		//copy the app to the correct place
		if(@!mkdir($basedir)) {
			OC_Log::write('core', 'Can\'t create app folder. Please fix permissions. ('.$basedir.')', OC_Log::ERROR);
			OC_Helper::rmdirr($extractDir);
			if($data['source']=='http') {
				unlink($path);
			}
			return false;
		}
		OC_Helper::copyr($extractDir, $basedir);

		//remove temporary files
		OC_Helper::rmdirr($extractDir);

		//install the database
		if(is_file($basedir.'/appinfo/database.xml')) {
			OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
		}

		//run appinfo/install.php
		if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) {
			include $basedir.'/appinfo/install.php';
		}

		//set the installed version
		OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
		OC_Appconfig::setValue($info['id'], 'enabled', 'no');

		//set remote/public handelers
		foreach($info['remote'] as $name=>$path) {
			OCP\CONFIG::setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path);
		}
		foreach($info['public'] as $name=>$path) {
			OCP\CONFIG::setAppValue('core', 'public_'.$name, $info['id'].'/'.$path);
		}

		OC_App::setAppTypes($info['id']);

		return $info['id'];
	}
开发者ID:ryanshoover,项目名称:core,代码行数:101,代码来源:installer.php

示例9: header

 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

// Set the content type to Javascript
header("Content-type: text/javascript");

// Check for access and enabled app
\OCP\JSON::checkLoggedIn();
if (!\OCP\App::isEnabled('secure_container')) {
	\OCP\JSON::error('Application "secure_container" is not enabled.');
}

// Get data
$app_dir = \OC_App::getInstallPath() . DIRECTORY_SEPARATOR . 'secure_container' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . '3rdparty' . DIRECTORY_SEPARATOR;
$content = '';
$wrapper_function = 'js_wrapper';
$wrapper_code = '';

switch (strtolower(stripslashes($_REQUEST['app']))) {
	case 'sjcl':
		$file = $app_dir . 'sjcl' . DIRECTORY_SEPARATOR . 'sjcl.js';
		$content = file_get_contents($file);
		$wrapper_function = 'OC_SJCL';
		$wrapper_code = 'this.sjcl = sjcl;';
		break;
	default:
		$content = '';
}
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:30,代码来源:jswrapper.php

示例10: checkServer

 /**
  * check if the current server configuration is suitable for ownCloud
  * @return array arrays with error messages and hints
  */
 public static function checkServer()
 {
     $errors = array();
     $defaults = new \OC_Defaults();
     $web_server_restart = 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' => '');
         //TODO: sane hint
         $web_server_restart = true;
     }
     //common hint for all file permissons error messages
     $permissionsHint = 'Permissions can usually be fixed by ' . '<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the apps directory</a> ' . 'or disabling the appstore in the config file.');
         }
     }
     $CONFIG_DATADIRECTORY = OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data");
     // 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="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-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));
         }
     }
     // check if all required php modules are present
     if (!class_exists('ZipArchive')) {
         $errors[] = array('error' => 'PHP module zip not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!class_exists('DOMDocument')) {
         $errors[] = array('error' => 'PHP module dom not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('xml_parser_create')) {
         $errors[] = array('error' => 'PHP module libxml not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('mb_detect_encoding')) {
         $errors[] = array('error' => 'PHP module mb multibyte not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('ctype_digit')) {
         $errors[] = array('error' => 'PHP module ctype is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('json_encode')) {
         $errors[] = array('error' => 'PHP module JSON is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('imagepng')) {
         $errors[] = array('error' => 'PHP module GD is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('gzencode')) {
         $errors[] = array('error' => 'PHP module zlib is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('iconv')) {
         $errors[] = array('error' => 'PHP module iconv is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (!function_exists('simplexml_load_string')) {
         $errors[] = array('error' => 'PHP module SimpleXML is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     if (floatval(phpversion()) < 5.3) {
         $errors[] = array('error' => 'PHP 5.3 is required.', 'hint' => 'Please ask your server administrator to update PHP to version 5.3 or higher.' . ' PHP 5.2 is no longer supported by ownCloud and the PHP community.');
         $web_server_restart = false;
     }
     if (!defined('PDO::ATTR_DRIVER_NAME')) {
         $errors[] = array('error' => 'PHP PDO module is not installed.', 'hint' => 'Please ask your server administrator to install the module.');
         $web_server_restart = false;
     }
     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.');
         $web_server_restart = false;
     }
     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.');
         $web_server_restart = true;
     }
//.........这里部分代码省略.........
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:101,代码来源:util.php


注:本文中的OC_App::getInstallPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。