Страница 1 из 1
Автоматическое перемещение тем
#4
Отправлено 20 Июль 2016 - 12:19
#6
Отправлено 20 Июль 2016 - 16:47
Никак не пойму, как сделать этот скрипт. Как пример взял этот http://ipbskins.ru/f...dpost__p__92366
Но он не подходит, там удаление картинок из галереи выполняется, а мне нужно перемещение тем... Как это реализовать?
Но он не подходит, там удаление картинок из галереи выполняется, а мне нужно перемещение тем... Как это реализовать?
#11
Отправлено 23 Июль 2016 - 23:45
Задача
<?php class task_item { protected $class; protected $task = array(); protected $registry; protected $DB; protected $lang; public function __construct( ipsRegistry $registry, $class, $task ) { $this->registry = $registry; $this->DB = $registry->DB(); $this->lang = $this->registry->getClass('class_localization'); $this->class = $class; $this->task = $task; } public function runTask() { $from_id = 1; // откуда $to_id = 5; // куда $older = 2 * 86400; // старше чем, сек $this->DB->update( 'topics', 'forum_id='.$to_id, 'start_date < '. ( IPS_UNIX_TIME_NOW - $older ) . ' AND forum_id='.$from_id ); if( ( $count = $this->DB->getAffectedRows() ) > 0 ) { $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' ); $modfunc = new $classToLoad( $this->registry ); $modfunc->forumRecount( $from_id ); $modfunc->forumRecount( $to_id ); } $this->class->appendTaskLog( $this->task, 'Moved topics: ' . $count ); //----------------------------------------- // Unlock Task: REQUIRED! //----------------------------------------- $this->class->unlockTask( $this->task ); } }
Сообщить об этой теме:
Страница 1 из 1