Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • BuildTask
  • CliDebugView
  • ConvertFrom26Task
  • Debug
  • DebugView
  • DeleteUnusedCustomerFilesTask
  • DevelopmentAdmin
  • FillLinkTrackingTask
  • FillOldLogDataTask
  • FindBadLinksTask
  • ImportTestContentTask
  • MigrationTask
  • MySQLDatabaseConfigurationHelper
  • PhotoGalleryMigrationTask
  • SapphireREPL
  • SS_Backtrace
  • SS_Cli
  • SS_Log
  • SS_LogEmailWriter
  • SS_LogErrorEmailFormatter
  • SS_LogErrorFileFormatter
  • SS_LogFileWriter
  • SS_ZendLog
  • TaskRunner
 1 <?php
 2 /*
 3  * Задача заполнения значний новых полей LogItem
 4  *
 5  * @author menedem
 6  */
 7 class FillOldLogDataTask extends MigrationTask {
 8     protected $title = "Fill old LogItem data";
 9 
10     protected $description = "Fill new fields of LogItem for old entries";
11 
12     /**
13      * Run the conversion.   
14      * 
15      * @param HTTPRequest
16      */
17     function run($request) {        
18         $items = DataObject::get('LogItem', "ItemTitle = '' OR MemberLogin = ''");
19         if ($items) {
20             foreach($items as $item) {
21                 $changes = false;
22                 $update = array();
23                 if (!$item->getField('ItemTitle')) {
24                     if ($item->Class && class_exists($item->Class) && $data = DataObject::get_by_id($item->Class, $item->ItemID)) {                                             
25                         $update[] = "ItemTitle = '" . Convert::raw2sql(trim($data->Title)) . "'";
26                         $changes = true;
27                         
28                     }
29                 }
30                 if (!$item->MemberLogin) {
31                     if ($member = DataObject::get_by_id('Member', $item->MemberID)) {                       
32                         $update[] = "MemberLogin = '" . Convert::raw2sql(trim($member->Title)) . "'";                       
33                         $changes = true;
34                     }
35                 }
36                 if ($changes) {                 
37                     DB::Query('UPDATE LogItem SET ' . implode(', ', $update) . ' WHERE ID = ' . $item->ID);
38                 }
39                 
40             }
41         }
42         unset($items);
43         echo "Old LogItems filled finished!\n";
44     }
45     
46 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0