当前位置: 首页>>代码示例>>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;未经允许,请勿转载。