Lines Matching refs:this

18  * Please note: this has not a complex move resolver. Move operations may not depend on each other (eg. you
38 * @var array the options for this move plan
76 $this->files = array(
86 $this->MoveOperator = plugin_load('helper', 'move_op');
88 $this->loadOptions();
99 $this->options = array(
113 'autoskip' => $this->getConf('autoskip'),
114 'autorewrite' => $this->getConf('autorewrite'),
121 $file = $this->files['opts'];
124 $this->options = array_merge($this->options, $options);
134 return io_saveFile($this->files['opts'], serialize($this->options));
144 if(isset($this->options[$name])) {
145 return $this->options[$name];
153 * Note, this otpion will only be set to the current instance of this helper object. It will only
160 $this->options[$name] = $value;
164 * Returns the progress of this plan in percent
170 $this->options['pages_all'] +
171 $this->options['media_all'];
174 $this->options['pages_run'] +
175 $this->options['media_run'];
177 if($this->options['autorewrite']) {
178 $max += $this->options['affpg_all'];
179 $remain += $this->options['affpg_run'];
192 return (bool) $this->options['started'];
196 * Check if this plan has been committed, yet
201 return $this->options['committed'];
211 $this->addMove($src, $dst, self::CLASS_DOC, self::TYPE_PAGES);
221 $this->addMove($src, $dst, self::CLASS_DOC, self::TYPE_MEDIA);
231 $this->addMove($src, $dst, self::CLASS_NS, self::TYPE_PAGES);
241 $this->addMove($src, $dst, self::CLASS_NS, self::TYPE_MEDIA);
254 if($this->options['committed']) throw new Exception('plan is committed already, can not be added to');
259 $this->plan[] = array(
271 foreach($this->files as $file) {
274 $this->plan = array();
275 $this->loadOptions();
291 if($this->options['committed']) throw new Exception('plan is committed already, can not be committed again');
296 usort($this->plan, array($this, 'planSorter'));
299 foreach($this->plan as $move) {
302 $this->addToDocumentList($move['src'], $move['dst'], $move['type']);
326 $this->addToDocumentList($from, $to, $move['type']);
331 // FIXME we use this to move namespace subscriptions later on and for now only do it on
334 $this->addToDocumentList($move['src'], $move['dst'], self::CLASS_NS);
336 $this->findMissingDocuments($move['src'] . ':', $move['dst'],$move['type']);
338 // store what pages are affected by this move
339 $this->findAffectedPages($move['src'], $move['dst'], $move['class'], $move['type']);
342 $this->storeDocumentLists();
344 if(!$this->options['pages_all'] && !$this->options['media_all']) {
345 msg($this->getLang('noaction'), -1);
349 $this->options['committed'] = true;
350 $this->saveOptions();
363 if(!$this->options['committed']) throw new Exception('plan is not committed yet!');
366 if(!$this->options['started']) $this->options['started'] = time();
370 if(@filesize($this->files['pagelist']) > 1) {
371 $todo = $this->stepThroughDocuments(self::TYPE_PAGES, $skip);
372 if($todo === false) return $this->storeError();
376 if(@filesize($this->files['medialist']) > 1) {
377 $todo = $this->stepThroughDocuments(self::TYPE_MEDIA, $skip);
378 if($todo === false) return $this->storeError();
382 if(@filesize($this->files['missing']) > 1 && @filesize($this->files['affected']) > 1) {
383 $todo = $this->stepThroughMissingDocuments(self::TYPE_PAGES);
384 if($todo === false) return $this->storeError();
388 if(@filesize($this->files['missing_media']) > 1 && @filesize($this->files['affected']) > 1) {
389 $todo = $this->stepThroughMissingDocuments(self::TYPE_MEDIA);
390 if($todo === false)return $this->storeError();
394 if(@filesize($this->files['namespaces']) > 1) {
395 $todo = $this->stepThroughNamespaces();
396 if($todo === false) return $this->storeError();
402 if($this->options['autorewrite'] && @filesize($this->files['affected']) > 1) {
403 $todo = $this->stepThroughAffectedPages();
404 if($todo === false) return $this->storeError();
409 $this->abort();
422 if(@file_exists($this->files['pagelist'])) {
423 $pagelist = file($this->files['pagelist']);
434 if(@file_exists($this->files['medialist'])) {
435 $medialist = file($this->files['medialist']);
446 if(@file_exists($this->files['affected'])) {
447 $medialist = file($this->files['affected']);
470 $file = $this->files['pagelist'];
475 $file = $this->files['medialist'];
485 $line = $this->getLastLine($doclist);
491 // should this item be skipped?
496 if(!$this->MoveOperator->$call($src, $dst)) {
497 $log .= $this->build_log_line($mark, $src, $dst, false); // FAILURE!
499 // automatically skip this item only if wanted...
500 if(!$this->options['autoskip']) {
507 $log .= $this->build_log_line($mark, $src, $dst, true); // SUCCESS!
517 $this->options[$items_run_counter]--;
518 $return_items_run = $this->options[$items_run_counter];
519 $this->write_log($log);
520 $this->saveOptions();
539 $doclist = fopen($this->files['affected'], 'a+');
541 $page = $this->getLastLine($doclist);
549 $this->options['affpg_run']--;
550 $this->saveOptions();
554 return $this->options['affpg_run'];
561 * the meta data to pages not linking to the affected pages but this should still be faster
562 * than figuring out which pages need this info.
580 $missing_fn = $this->files['missing'];
582 $missing_fn = $this->files['missing_media'];
592 $affected = file($this->files['affected']);
622 $lines = io_readFile($this->files['namespaces']);
633 @unlink($this->files['namespaces']);
649 $this->options['lasterror'] = $last['msg'];
652 $this->options['lasterror'] = 'Unknown error';
654 $this->saveOptions();
663 $this->options['lasterror'] = false;
664 $this->saveOptions();
673 return $this->options['lasterror'];
679 * If the src has been added before, this is ignored. This makes sure you can move a single page
698 if(!isset($this->tmpstore[$store][$src])) {
699 $this->tmpstore[$store][$src] = $dst;
712 if(!isset($this->tmpstore['affpg'][$page])) {
713 $this->tmpstore['affpg'][$page] = true;
751 $this->addToAffectedPagesList($pages);
764 // FIXME this duplicates Doku_Indexer::getIndex()
784 $this->tmpstore['miss'][$page] = $newpage;
789 $this->tmpstore['miss_media'][$page] = $newpage;
802 'pages' => $this->files['pagelist'],
803 'media' => $this->files['medialist'],
804 'ns' => $this->files['namespaces'],
805 'affpg' => $this->files['affected'],
806 'miss' => $this->files['missing'],
807 'miss_media' => $this->files['missing_media'],
812 $count = count($this->tmpstore[$store]);
817 $this->tmpstore[$store] = array_reverse($this->tmpstore[$store]); // store in reverse order
818 foreach($this->tmpstore[$store] as $src => $dst) {
830 $this->options[$store . '_all'] = $count;
831 $this->options[$store . '_run'] = $count;
835 $this->tmpstore[$store] = array();
859 continue; // this line was empty, continue
948 $optime = $this->options['started'];