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


PHP DB::alteration_message方法代码示例

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


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

示例1: run

 public function run($request)
 {
     $migrated = FileMigrationHelper::singleton()->run();
     if ($migrated) {
         DB::alteration_message("{$migrated} File DataObjects upgraded", "changed");
     } else {
         DB::alteration_message("No File DataObjects need upgrading", "notice");
     }
 }
开发者ID:SpiritLevel,项目名称:silverstripe-framework,代码行数:9,代码来源:MigrateFileTask.php

示例2: requireDefaultRecords

 /**
  * Add default records to database. This function is called whenever the
  * database is built, after the database tables have all been created. Overload
  * this to add default records when the database is built, but make sure you
  * call parent::requireDefaultRecords().
  *
  * @uses DataExtension->requireDefaultRecords()
  */
 public function requireDefaultRecords()
 {
     $defaultRecords = $this->stat('default_records');
     if (!empty($defaultRecords)) {
         $hasData = DataObject::get_one($this->class);
         if (!$hasData) {
             $className = $this->class;
             foreach ($defaultRecords as $record) {
                 $obj = $this->model->{$className}->newObject($record);
                 $obj->write();
             }
             DB::alteration_message("Added default records to {$className} table", "created");
         }
     }
     // Let any extentions make their own database default data
     $this->extend('requireDefaultRecords', $dummy);
 }
开发者ID:SpiritLevel,项目名称:silverstripe-framework,代码行数:25,代码来源:DataObject.php

示例3: requireDefaultRecords

 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Check if old file records should be migrated
     if (!$this->config()->migrate_legacy_file) {
         return;
     }
     $migrated = FileMigrationHelper::singleton()->run();
     if ($migrated) {
         DB::alteration_message("{$migrated} File DataObjects upgraded", "changed");
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:12,代码来源:File.php

示例4: cleanupVersionedOrphans

 /**
  * Cleanup orphaned records in the _versions table
  *
  * @param string $baseTable base table to use as authoritative source of records
  * @param string $childTable Sub-table to clean orphans from
  */
 protected function cleanupVersionedOrphans($baseTable, $childTable)
 {
     // Skip if child table doesn't exist
     if (!DB::get_schema()->hasTable($childTable)) {
         return;
     }
     // Skip if tables are the same
     if ($childTable === $baseTable) {
         return;
     }
     // Select all orphaned version records
     $orphanedQuery = SQLSelect::create()->selectField("\"{$childTable}\".\"ID\"")->setFrom("\"{$childTable}\"");
     // If we have a parent table limit orphaned records
     // to only those that exist in this
     if (DB::get_schema()->hasTable($baseTable)) {
         $orphanedQuery->addLeftJoin($baseTable, "\"{$childTable}\".\"RecordID\" = \"{$baseTable}\".\"RecordID\"\n\t\t\t\t\tAND \"{$childTable}\".\"Version\" = \"{$baseTable}\".\"Version\"")->addWhere("\"{$baseTable}\".\"ID\" IS NULL");
     }
     $count = $orphanedQuery->count();
     if ($count > 0) {
         DB::alteration_message("Removing {$count} orphaned versioned records", "deleted");
         $ids = $orphanedQuery->execute()->column();
         foreach ($ids as $id) {
             DB::prepared_query("DELETE FROM \"{$childTable}\" WHERE \"ID\" = ?", array($id));
         }
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:32,代码来源:Versioned.php


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