$input = trim(fgets($stdIn)); fclose($stdIn); if ($input !== "ja") { echo "Abbruch!"; nl(); exit(); } nl(); if (!$exec) { echo "DEMO:"; nl(); } echo ProgressBar::start($numRoomsMoved, "Räume werden umgezogen..."); global $c_send_email; $c_send_email = false; $moveItem = $moveList->getFirst(); $index = 0; while ($moveItem) { $afterList = new cs_list(); if (($index + 1) < $moveList->getCount()) { $afterList = $moveList->getSubList($index + 1, $moveList->getCount() - ($index + 1)); } $handledProjectList = moveRoom($environment, $afterList, $moveItem, $exec, $newPortalId); if ($handledProjectList->isNotEmpty()) {
static function Shutdown() { $error = error_get_last(); if ($error !== NULL and isset($error['type']) and $error['type'] == 1) { //Only trigger fatal errors on shutdown. self::$php_errors++; self::Text('PHP ERROR - FATAL(' . $error['type'] . '): ' . $error['message'] . ' File: ' . $error['file'] . ' Line: ' . $error['line'], $error['file'], $error['line'], __METHOD__, 1); if (defined('TIMETREX_API') and TIMETREX_API == TRUE) { //Only when a fatal error occurs. global $amf_message_id; if ($amf_message_id != '') { $progress_bar = new ProgressBar(); $progress_bar->start($amf_message_id, 2, 1, TTi18n::getText('ERROR: Operation cannot be completed.')); unset($progress_bar); } } } if (self::$php_errors > 0) { self::Text('Detected PHP errors (' . self::$php_errors . '), emailing log...'); self::Text('---------------[ ' . Date('d-M-Y G:i:s O') . ' (PID: ' . getmypid() . ') ]---------------'); self::emailLog(); if ($error !== NULL) { //Fatal error, write to log once more as this won't be called automatically. self::writeToLog(); } } return TRUE; }
} } $row->save(); $levels[$level + 1][] = $row->id; $categories[$table][] = $row->id; print ProgressBar::next(); } } unset($levels, $date_min, $date_max, $i, $row, $created, $level, $parent_id); print ProgressBar::finish(); print "DONE\r\n\n"; } } // Generate articles. if ($numbers['articles']) { ProgressBar::start($numbers['articles']); ProgressBar::setMessage('Adding articles...'); $date_min = new DateTime('-3 years'); $date_max = new DateTime(); for ($i = 0; $i < $numbers['articles']; $i++) { $row = Library\ObjectManager::getInstance()->getObject('com:articles.model.articles')->getItem(); $row->title = $generator->words(pick_random(range(1, 5))); $row->introtext = $generator->sentences(pick_random(range(1, 3))); $row->fulltext = $generator->sentences(pick_random(range(0, 5))); $row->published = (int) (rand(0, 20) > 0); $row->categories_category_id = pick_random($categories['articles']); $created = new DateTime('@' . rand($date_min->format('U'), $date_max->format('U'))); $row->created_on = $created->format('Y-m-d H:i:s'); $row->created_by = pick_random($users); $row->save(); print ProgressBar::next();
/** * Called by start and finish * * @param array $options array * * @static * @return void */ public static function reset($options = array()) { $options = array_merge(self::$defaults, $options); if (empty($options['done'])) { $options['done'] = 0; } if (empty($options['start'])) { $options['start'] = time(); } if (empty($options['total'])) { $options['total'] = 0; } self::$done = $options['done']; self::$format = $options['format']; self::$message = $options['message']; self::$size = $options['size']; self::$start = $options['start']; self::$total = $options['total']; self::setWidth($options['width']); }