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

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • 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
  • 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 class FillLinkTrackingTask extends BuildTask {
 4     protected $description = 'Update page - files link tracking for attached files and images';
 5 
 6     function run($request) {
 7         if (class_exists('DataObjectFileTrackingDecorator')) {
 8             $baseClasses = ClassInfo::subClassesFor('DataObject');
 9             unset($baseClasses[0]); // выкидываем DataObject
10             foreach($baseClasses as $className) {
11                 if (!ClassInfo::is_subclass_of($className, 'SiteTree')) {
12                     if (!in_array($className, DataObjectFileTrackingDecorator::$skip_classes)) {
13                         if (!ClassInfo::is_subclass_of($className, 'File')) {
14                             if ($objects = DataObject::get($className)) {                           
15                                 foreach($objects as $object) {
16                                     $object->saveTracking();
17                                     if ($db = $object->db()) { // для HTMLText сохраняем трекинг для ссылок на файлы и вложенные картинки
18                                         foreach($db as $name=>$type) {
19                                             if ($type == 'HTMLText') {
20                                                 $field = new HtmlEditorField($name);
21                                                 $field->setValue($object->{$name});
22                                                 $field->saveInto($object);
23                                             }
24                                         }
25                                     }
26                                 }
27                             }
28                         }
29                     }
30                 }
31             }
32         }
33     }
34 }
35 
[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.1 API Docs API documentation generated by ApiGen 2.8.0