當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Craft::saveInfo方法代碼示例

本文整理匯總了PHP中Craft::saveInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Craft::saveInfo方法的具體用法?PHP Craft::saveInfo怎麽用?PHP Craft::saveInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Craft的用法示例。


在下文中一共展示了Craft::saveInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setNewCraftInfo

 /**
  * @param $version
  * @param $build
  * @param $releaseDate
  * @return bool
  */
 public function setNewCraftInfo($version, $build, $releaseDate)
 {
     $info = Craft::getInfo();
     $info->version = $version;
     $info->build = $build;
     $info->releaseDate = $releaseDate;
     // TODO: Deprecate after next breakpoint release.
     $info->track = 'stable';
     return Craft::saveInfo($info);
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:16,代碼來源:UpdatesService.php

示例2: actionSaveGeneralSettings

 /**
  * Saves the general settings.
  */
 public function actionSaveGeneralSettings()
 {
     $this->requirePostRequest();
     $info = Craft::getInfo();
     $info->on = (bool) craft()->request->getPost('on');
     $info->siteName = craft()->request->getPost('siteName');
     $info->siteUrl = craft()->request->getPost('siteUrl');
     $info->timezone = craft()->request->getPost('timezone');
     if (Craft::saveInfo($info)) {
         craft()->userSession->setNotice(Craft::t('General settings saved.'));
         $this->redirectToPostedUrl();
     } else {
         craft()->userSession->setError(Craft::t('Couldn’t save general settings.'));
         // Send the info back to the template
         craft()->urlManager->setRouteVariables(array('info' => $info));
     }
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:20,代碼來源:SystemSettingsController.php

示例3: _createAndPopulateInfoTable

 /**
  * Populates the info table with install and environment information.
  *
  * @access private
  * @param $inputs
  * @throws Exception
  */
 private function _createAndPopulateInfoTable($inputs)
 {
     Craft::log('Creating the info table.');
     craft()->db->createCommand()->createTable('info', array('version' => array('column' => ColumnType::Char, 'length' => 15, 'null' => false), 'build' => array('column' => ColumnType::Int, 'length' => 11, 'unsigned' => true, 'null' => false), 'packages' => array('column' => ColumnType::Varchar, 'length' => 200), 'releaseDate' => array('column' => ColumnType::DateTime, 'null' => false), 'siteName' => array('column' => ColumnType::Varchar, 'length' => 100, 'null' => false), 'siteUrl' => array('column' => ColumnType::Varchar, 'length' => 255, 'null' => false), 'timezone' => array('column' => ColumnType::Varchar, 'length' => 30), 'on' => array('column' => ColumnType::TinyInt, 'length' => 1, 'unsigned' => true, 'default' => false, 'null' => false), 'maintenance' => array('column' => ColumnType::TinyInt, 'length' => 1, 'unsigned' => true, 'default' => false, 'null' => false), 'track' => array('column' => ColumnType::Varchar, 'maxLength' => 40, 'required' => true)));
     Craft::log('Finished creating the info table.');
     Craft::log('Populating the info table.');
     $info = new InfoModel(array('version' => CRAFT_VERSION, 'build' => CRAFT_BUILD, 'releaseDate' => CRAFT_RELEASE_DATE, 'siteName' => $inputs['siteName'], 'siteUrl' => $inputs['siteUrl'], 'on' => 1, 'maintenance' => 0, 'track' => 'stable'));
     if (Craft::saveInfo($info)) {
         Craft::log('Info table populated successfully.');
     } else {
         Craft::log('Could not populate the info table.', LogLevel::Error);
         throw new Exception(Craft::t('There was a problem saving to the info table:') . $this->_getFlattenedErrors($info->getErrors()));
     }
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:21,代碼來源:InstallService.php


注:本文中的Craft::saveInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。