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


PHP FileManager::fileExists方法代码示例

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


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

示例1: addPluginVersions

 /**
  * For 2.3 upgrade:  Add initial plugin data to versions table
  * @return boolean
  */
 function addPluginVersions()
 {
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('site.VersionCheck');
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category, true);
         $plugins = PluginRegistry::getPlugins($category);
         foreach ($plugins as $plugin) {
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if (FileManager::fileExists($versionFile)) {
                 $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
                 $pluginVersion->setCurrent(1);
                 $versionDao->insertVersion($pluginVersion);
             } else {
                 $pluginVersion = new Version();
                 $pluginVersion->setMajor(1);
                 $pluginVersion->setMinor(0);
                 $pluginVersion->setRevision(0);
                 $pluginVersion->setBuild(0);
                 $pluginVersion->setDateInstalled(Core::getCurrentDate());
                 $pluginVersion->setCurrent(1);
                 $pluginVersion->setProductType('plugins.' . $category);
                 $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                 $versionDao->insertVersion($pluginVersion);
             }
         }
     }
 }
开发者ID:jalperin,项目名称:harvester,代码行数:34,代码来源:Upgrade.inc.php

示例2: deposits

 /**
  * Provide an endpoint for the PLN staging server to retrieve a deposit
  * @param array $args
  * @param Request $request
  */
 function deposits($args, &$request)
 {
     $journal =& $request->getJournal();
     $depositDao =& DAORegistry::getDAO('DepositDAO');
     $fileManager = new FileManager();
     $dispatcher = $request->getDispatcher();
     $depositUuid = !isset($args[0]) || empty($args[0]) ? null : $args[0];
     // sanitize the input
     if (!preg_match('/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/', $depositUuid)) {
         error_log(__("plugins.generic.pln.error.handler.uuid.invalid"));
         $dispatcher->handle404();
         return FALSE;
     }
     $deposit =& $depositDao->getDepositByUUID($journal->getId(), $depositUuid);
     if (!$deposit) {
         error_log(__("plugins.generic.pln.error.handler.uuid.notfound"));
         $dispatcher->handle404();
         return FALSE;
     }
     $depositPackage = new DepositPackage($deposit, null);
     $depositBag = $depositPackage->getPackageFilePath();
     if (!$fileManager->fileExists($depositBag)) {
         error_log("plugins.generic.pln.error.handler.file.notfound");
         $dispatcher->handle404();
         return FALSE;
     }
     return $fileManager->downloadFile($depositBag, mime_content_type($depositBag), TRUE);
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:33,代码来源:PLNHandler.inc.php

示例3: addCustomLocale

 function addCustomLocale($hookName, $args)
 {
     $locale =& $args[0];
     $localeFilename =& $args[1];
     $journal = Request::getJournal();
     $journalId = $journal->getId();
     $publicFilesDir = Config::getVar('files', 'public_files_dir');
     $customLocalePath = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
     import('file.FileManager');
     if (FileManager::fileExists($customLocalePath)) {
         Locale::registerLocaleFile($locale, $customLocalePath, true);
     }
     return true;
 }
开发者ID:philschatz,项目名称:ojs,代码行数:14,代码来源:CustomLocalePlugin.inc.php

示例4: addCustomLocale

 /**
  * Hook callback to add a custom locale file.
  * @param $hookName string
  * @param $args array
  * @return boolean
  */
 function addCustomLocale($hookName, $args)
 {
     $locale =& $args[0];
     $localeFilename =& $args[1];
     $request =& $this->getRequest();
     $journal = $request->getJournal();
     $journalId = $journal->getId();
     $publicFilesDir = Config::getVar('files', 'public_files_dir');
     $customLocalePath = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
     import('lib.pkp.classes.file.FileManager');
     $fileManager = new FileManager();
     if ($fileManager->fileExists($customLocalePath)) {
         AppLocale::registerLocaleFile($locale, $customLocalePath, true);
     }
     return true;
 }
开发者ID:pkp,项目名称:ojs,代码行数:22,代码来源:CustomLocalePlugin.inc.php

示例5: deposits

 /**
  * Provide an endpoint for the PLN staging server to retrieve a deposit
  * @param array $args
  * @param Request $request
  */
 function deposits($args, &$request)
 {
     $journal =& $request->getJournal();
     $plnPlugin =& PluginRegistry::getPlugin('generic', PLN_PLUGIN_NAME);
     $depositDao =& DAORegistry::getDAO('DepositDAO');
     $fileManager = new FileManager();
     $depositUuid = !isset($args[0]) || empty($args[0]) ? null : $args[0];
     // sanitize the input
     if (!preg_match('/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/', $depositUuid)) {
         return FALSE;
     }
     $deposit =& $depositDao->getDepositByUUID($journal->getId(), $depositUuid);
     if (!$deposit) {
         return FALSE;
     }
     $depositPackage = new DepositPackage($deposit);
     $depositBag = $depositPackage->getPackageFilePath();
     if (!$fileManager->fileExists($depositBag)) {
         return FALSE;
     }
     //TODO: Additional check here for journal UUID in HTTP header from staging server
     return $fileManager->downloadFile($depositBag, mime_content_type($depositBag), TRUE);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:28,代码来源:PLNHandler.inc.php

示例6: register

 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if ($this->getEnabled()) {
             import('lib.pkp.classes.file.FileManager');
             $press = Request::getPress();
             $pressId = $press->getId();
             $locale = Locale::getLocale();
             $localeFiles = Locale::getLocaleFiles($locale);
             $publicFilesDir = Config::getVar('files', 'public_files_dir');
             $customLocaleDir = $publicFilesDir . DIRECTORY_SEPARATOR . 'presses' . DIRECTORY_SEPARATOR . $pressId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR;
             foreach ($localeFiles as $localeFile) {
                 $localeFilename = $localeFile->getFilename();
                 $customLocalePath = $customLocaleDir . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
                 if (FileManager::fileExists($customLocalePath)) {
                     Locale::registerLocaleFile($locale, $customLocalePath, true);
                 }
             }
         }
         return true;
     }
     return false;
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:23,代码来源:CustomLocalePlugin.inc.php

示例7: deleteFile

 /**
  * Delete a file.
  * @param $filePath string the location of the file to be deleted
  * @return boolean returns true if successful
  */
 function deleteFile($filePath)
 {
     if (FileManager::fileExists($filePath)) {
         return unlink($filePath);
     } else {
         return false;
     }
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:13,代码来源:FileManager.inc.php

示例8: FileManager

 /**
  * Checks whether the given version file exists and whether it
  * contains valid data. Returns a Version object if everything
  * is ok, otherwise null. If $returnErroMsg is true, returns the
  * error message.
  *
  * @param $versionFile string
  * @param $returnErrorMesg boolean
  * @return Version or null/string if invalid or missing version file
  */
 function &getValidPluginVersionInfo($versionFile, $returnErrorMsg = false)
 {
     $nullVar = null;
     $errorMsg = null;
     $fileManager = new FileManager();
     if ($fileManager->fileExists($versionFile)) {
         $versionInfo =& VersionCheck::parseVersionXML($versionFile);
     } else {
         $errorMsg = 'manager.plugins.versionFileNotFound';
     }
     // Validate plugin name and type to avoid abuse
     if (is_null($errorMsg)) {
         $productType = explode(".", $versionInfo['type']);
         if (count($productType) != 2 || $productType[0] != 'plugins') {
             $errorMsg = 'manager.plugins.versionFileInvalid';
         }
     }
     if (is_null($errorMsg)) {
         $pluginVersion =& $versionInfo['version'];
         $namesToValidate = array($pluginVersion->getProduct(), $productType[1]);
         foreach ($namesToValidate as $nameToValidate) {
             if (!String::regexp_match('/[a-z][a-zA-Z0-9]+/', $nameToValidate)) {
                 $errorMsg = 'manager.plugins.versionFileInvalid';
                 break;
             }
         }
     }
     if ($errorMsg) {
         if ($returnErrorMsg) {
             return $errorMsg;
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('message', $errorMsg);
             return $nullVar;
         }
     } else {
         return $pluginVersion;
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:49,代码来源:VersionCheck.inc.php

示例9: createData

 /**
  * Create initial required data.
  * @return boolean
  */
 function createData()
 {
     if ($this->getParam('manualInstall')) {
         // Add insert statements for default data
         // FIXME use ADODB data dictionary?
         $this->executeSQL(sprintf('INSERT INTO site (primary_locale, installed_locales) VALUES (\'%s\', \'%s\')', $this->getParam('locale'), join(':', $this->installedLocales)));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'title', 'string', addslashes(Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'contactName', 'string', addslashes(Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'contactEmail', 'string', addslashes($this->getParam('adminEmail')), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO users (username, first_name, last_name, password, email, date_registered, date_last_login) VALUES (\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')', $this->getParam('adminUsername'), $this->getParam('adminUsername'), $this->getParam('adminUsername'), Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')), $this->getParam('adminEmail'), Core::getCurrentDate(), Core::getCurrentDate()));
         $this->executeSQL(sprintf('INSERT INTO roles (conference_id, user_id, role_id) VALUES (%d, (SELECT user_id FROM users WHERE username = \'%s\'), %d)', 0, $this->getParam('adminUsername'), ROLE_ID_SITE_ADMIN));
         // Install email template list and data for each locale
         $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
         foreach ($emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename(), true) as $sql) {
             $this->executeSQL($sql);
         }
         foreach ($this->installedLocales as $locale) {
             foreach ($emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale), true) as $sql) {
                 $this->executeSQL($sql);
             }
         }
     } else {
         // Add initial site data
         $locale = $this->getParam('locale');
         $siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn);
         $site = new Site();
         $site->setRedirect(0);
         $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH);
         $site->setPrimaryLocale($locale);
         $site->setInstalledLocales($this->installedLocales);
         $site->setSupportedLocales($this->installedLocales);
         if (!$siteDao->insertSite($site)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
         $siteSettingsDao->updateSetting('title', array($locale => Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
         $siteSettingsDao->updateSetting('contactName', array($locale => Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
         $siteSettingsDao->updateSetting('contactEmail', array($locale => $this->getParam('adminEmail')), null, true);
         // Add initial site administrator user
         $userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn);
         $user = new User();
         $user->setUsername($this->getParam('adminUsername'));
         $user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')));
         $user->setFirstName($user->getUsername());
         $user->setLastName('');
         $user->setEmail($this->getParam('adminEmail'));
         if (!$userDao->insertUser($user)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         $roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
         $role = new Role();
         $role->setConferenceId(0);
         $role->setUserId($user->getId());
         $role->setRoleId(ROLE_ID_SITE_ADMIN);
         if (!$roleDao->insertRole($role)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         // Install email template list and data for each locale
         $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
         $emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
         foreach ($this->installedLocales as $locale) {
             $emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
         }
         // Add initial plugin data to versions table
         $versionDao =& DAORegistry::getDAO('VersionDAO');
         import('site.VersionCheck');
         $categories = PluginRegistry::getCategories();
         foreach ($categories as $category) {
             PluginRegistry::loadCategory($category, true);
             $plugins = PluginRegistry::getPlugins($category);
             foreach ($plugins as $plugin) {
                 $versionFile = $plugin->getPluginPath() . '/version.xml';
                 if (FileManager::fileExists($versionFile)) {
                     $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                     $pluginVersion = $versionInfo['version'];
                     $pluginVersion->setCurrent(1);
                     $versionDao->insertVersion($pluginVersion);
                 } else {
                     $pluginVersion = new Version();
                     $pluginVersion->setMajor(1);
                     $pluginVersion->setMinor(0);
                     $pluginVersion->setRevision(0);
                     $pluginVersion->setBuild(0);
                     $pluginVersion->setDateInstalled(Core::getCurrentDate());
                     $pluginVersion->setCurrent(1);
                     $pluginVersion->setProductType('plugins.' . $category);
                     $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                     $versionDao->insertVersion($pluginVersion);
                 }
             }
         }
     }
     return true;
//.........这里部分代码省略.........
开发者ID:jalperin,项目名称:ocs,代码行数:101,代码来源:Install.inc.php

示例10: handleWrite

 /**
  * PRIVATE routine to write a minutes file and add it to the database.
  * @param $fileName original filename of the file
  * @param $contents string contents of the file to write
  * @param $mimeType string the mime type of the file
  * @param $type string identifying type
  * @param $fileId int ID of an existing file to update
  * @return int the file ID (false if upload failed)
  */
 function handleWrite(&$pdf, $type, $fileId = null)
 {
     if (HookRegistry::call('MinutesFileManager::handleWrite', array(&$contents, &$fileId, &$result))) {
         return $result;
     }
     $minutesFileDao =& DAORegistry::getDAO('MinutesFileDAO');
     $typePath = $this->typeToPath($type);
     $dir = $this->filesDir . $typePath . '/';
     if (!$fileId) {
         $minutesFile =& $minutesFileDao->getGeneratedMinutesFile($this->meeting->getId(), $typePath);
         if (!$minutesFile) {
             $minutesFile =& $this->generateDummyFile($this->meeting);
         }
         $dummyFile = true;
     } else {
         $dummyFile = false;
         $minutesFile = new MinutesFile();
         $minutesFile->setMeetingId($this->meetingId);
         $minutesFile->setFileId($fileId);
     }
     $minutesFile->setFileType('application/pdf');
     $minutesFile->setOriginalFileName(null);
     $minutesFile->setType($typePath);
     $minutesFile->setDateCreated(Core::getCurrentDate());
     $newFileName = $this->generateFilename($minutesFile, $typePath, '.pdf');
     if (!FileManager::fileExists($dir, 'dir')) {
         FileManager::mkdirtree($dir);
     }
     if ($pdf->Output($dir . $newFileName, "F") != '') {
         $minutesFileDao->deleteMinutesFileById($minutesFile->getFileId());
         return false;
     } else {
         $minutesFile->setFileSize(filesize($dir . $newFileName));
     }
     if ($dummyFile) {
         $minutesFileDao->updateMinutesFile($minutesFile);
     } else {
         $minutesFileDao->insertMinutesFile($minutesFile);
     }
     return $minutesFile->getFileId();
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:50,代码来源:MinutesFileManager.inc.php

示例11: deletePlugin

 /**
  * Delete a plugin from the system
  * @param plugin string
  */
 function deletePlugin($plugin)
 {
     $this->validate();
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('path', 'delete');
     $templateMgr->assign('deleted', false);
     $templateMgr->assign('error', false);
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($plugin, true);
     $category = $this->getPluginCategory($plugin);
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         //make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             FileManager::rmtree($pluginDest);
         }
         if (FileManager::fileExists($pluginDest, 'dir')) {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.deleteError');
         } else {
             $versionDao->disableVersion($plugin);
             $templateMgr->assign('deleted', true);
         }
     } else {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', 'manager.plugins.doesNotExist');
     }
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category));
     $templateMgr->display('manager/plugins/managePlugins.tpl');
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:35,代码来源:PluginManagementHandler.inc.php

示例12: execute

 /**
  * Process apache log files, copying and filtering them
  * to the usage stats stage directory. Can work with both
  * a specific file or a directory.
  */
 function execute()
 {
     $fileMgr = new FileManager();
     $filesDir = Config::getVar('files', 'files_dir');
     $filePath = current($this->argv);
     $usageStatsDir = $this->_usageStatsDir;
     $tmpDir = $this->_tmpDir;
     if ($fileMgr->fileExists($tmpDir, 'dir')) {
         $fileMgr->rmtree($tmpDir);
     }
     if (!$fileMgr->mkdir($tmpDir)) {
         printf(__('admin.copyAccessLogFileTool.error.creatingFolder', array('tmpDir' => $tmpDir)) . "\n");
         exit(1);
     }
     if ($fileMgr->fileExists($filePath, 'dir')) {
         // Directory.
         $filesToCopy = glob($filePath . DIRECTORY_SEPARATOR . '*.*');
         foreach ($filesToCopy as $file) {
             // If a base filename is given as a parameter, check it.
             if (count($this->argv) == 2) {
                 $baseFilename = $this->argv[1];
                 if (strpos(pathinfo($file, PATHINFO_BASENAME), $baseFilename) !== 0) {
                     continue;
                 }
             }
             $this->_copyFile($file);
         }
     } else {
         if ($fileMgr->fileExists($filePath)) {
             // File.
             $this->_copyFile($filePath);
         } else {
             // Can't access.
             printf(__('admin.copyAccessLogFileTool.error.acessingFile', array('filePath' => $filePath)) . "\n");
         }
     }
     $fileMgr->rmtree($tmpDir);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:43,代码来源:copyAccessLogFileTool.php

示例13: assert

 /**
  * Apply an XSLT transform to a given XML and XSL. Both parameters
  * can be either strings, files or DOM objects.
  * @param $xml mixed
  * @param $xmlType integer
  * @param $xsl mixed
  * @param $xslType integer
  * @param $resultType integer
  * @return mixed return type depends on the $returnType parameter and can be
  *  DOMDocument or string. The method returns a boolean value of false if the
  *  transformation fails for some reason.
  */
 function &transform(&$xml, $xmlType, &$xsl, $xslType, $resultType)
 {
     // If either XML or XSL file don't exist, then fail without trying to process XSLT
     if ($xmlType == XSL_TRANSFORMER_DOCTYPE_FILE) {
         if (!FileManager::fileExists($xml)) {
             return false;
         }
     }
     if ($xslType == XSL_TRANSFORMER_DOCTYPE_FILE) {
         if (!FileManager::fileExists($xsl)) {
             return false;
         }
     }
     // The result type can only be string or DOM
     assert($resultType != XSL_TRANSFORMER_DOCTYPE_FILE);
     switch ($this->processor) {
         case 'External':
             return $this->_transformExternal(&$xml, $xmlType, &$xsl, $xslType, $resultType);
         case 'PHP4':
             return $this->_transformPHP4(&$xml, $xmlType, &$xsl, $xslType, $resultType);
         case 'PHP5':
             return $this->_transformPHP5(&$xml, $xmlType, &$xsl, $xslType, $resultType);
         default:
             // No XSLT processor available
             $falseVar = false;
             return $falseVar;
     }
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:40,代码来源:XSLTransformer.inc.php

示例14: createData

 /**
  * Create initial required data.
  * @return boolean
  */
 function createData()
 {
     // Add initial site data
     $locale = $this->getParam('locale');
     $siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn);
     $site = new Site();
     $site->setRedirect(0);
     $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH);
     $site->setPrimaryLocale($locale);
     $site->setInstalledLocales($this->installedLocales);
     $site->setSupportedLocales($this->installedLocales);
     if (!$siteDao->insertSite($site)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
     $siteSettingsDao->updateSetting('title', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
     $siteSettingsDao->updateSetting('contactName', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
     $siteSettingsDao->updateSetting('contactEmail', array($locale => $this->getParam('adminEmail')), null, true);
     // Add initial site administrator user
     $userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn);
     $user = new User();
     $user->setUsername($this->getParam('adminUsername'));
     $user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')));
     $user->setFirstName($user->getUsername());
     $user->setLastName('');
     $user->setEmail($this->getParam('adminEmail'));
     if (!$userDao->insertUser($user)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     $roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
     $role = new Role();
     $role->setConferenceId(0);
     $role->setUserId($user->getId());
     $role->setRoleId(ROLE_ID_SITE_ADMIN);
     if (!$roleDao->insertRole($role)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     // Install email template list and data for each locale
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
     foreach ($this->installedLocales as $locale) {
         $emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
     }
     // Add initial plugin data to versions table
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('site.VersionCheck');
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category, true);
         $plugins = PluginRegistry::getPlugins($category);
         foreach ($plugins as $plugin) {
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if (FileManager::fileExists($versionFile)) {
                 $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
                 $pluginVersion->setCurrent(1);
                 $versionDao->insertVersion($pluginVersion);
             } else {
                 $pluginVersion = new Version();
                 $pluginVersion->setMajor(1);
                 $pluginVersion->setMinor(0);
                 $pluginVersion->setRevision(0);
                 $pluginVersion->setBuild(0);
                 $pluginVersion->setDateInstalled(Core::getCurrentDate());
                 $pluginVersion->setCurrent(1);
                 $pluginVersion->setProductType('plugins.' . $category);
                 $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                 $versionDao->insertVersion($pluginVersion);
             }
         }
     }
     return true;
 }
开发者ID:sedici,项目名称:ocs,代码行数:80,代码来源:Install.inc.php

示例15: loadCategoryData

 /**
  * @copydoc CategoryGridHandler::loadCategoryData()
  */
 function loadCategoryData($request, $categoryDataElement, $filter)
 {
     $plugins =& PluginRegistry::loadCategory($categoryDataElement);
     $versionDao = DAORegistry::getDAO('VersionDAO');
     import('lib.pkp.classes.site.VersionCheck');
     $fileManager = new FileManager();
     $notHiddenPlugins = array();
     foreach ((array) $plugins as $plugin) {
         if (!$plugin->getHideManagement()) {
             $notHiddenPlugins[$plugin->getName()] = $plugin;
         }
         $version = $plugin->getCurrentVersion();
         if ($version == null) {
             // this plugin is on the file system, but not installed.
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if ($fileManager->fileExists($versionFile)) {
                 $versionInfo = VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
             } else {
                 $pluginVersion = new Version(1, 0, 0, 0, Core::getCurrentDate(), 1, 'plugins.' . $plugin->getCategory(), basename($plugin->getPluginPath()), '', 0, $plugin->isSitePlugin());
             }
             $versionDao->insertVersion($pluginVersion, true);
         }
     }
     if (!is_null($filter) && isset($filter['pluginName']) && $filter['pluginName'] != "") {
         // Find all plugins that have the filter name string in their display names.
         $filteredPlugins = array();
         foreach ($notHiddenPlugins as $plugin) {
             /* @var $plugin Plugin */
             $pluginName = $plugin->getDisplayName();
             if (stristr($pluginName, $filter['pluginName']) !== false) {
                 $filteredPlugins[$plugin->getName()] = $plugin;
             }
         }
         return $filteredPlugins;
     }
     return $notHiddenPlugins;
 }
开发者ID:piero-tasso,项目名称:pkp-lib,代码行数:41,代码来源:PluginGridHandler.inc.php


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