Lines Matching refs:this

22         $this->arguments = func_get_args();
29 return $this->arguments;
97 $this->pageOffset = $pageOffset;
98 $this->originalText = $text;
99 $this->replacedText = preg_replace($regexp, $replacement, $text);
100 $this->contextBefore = $this->cropContextBefore($pageText, $pageOffset, $contextChars, $contextLines);
101 $this->contextAfter = $this->cropContextAfter($pageText, $pageOffset + strlen($text), $contextChars, $contextLines);
102 $this->marked = FALSE;
103 $this->applied = FALSE;
110 return $this->pageOffset;
117 return $this->originalText;
124 return $this->replacedText;
131 return $this->contextBefore;
138 return $this->contextAfter;
145 $this->marked = $marked;
152 return $this->marked;
159 $pageOffset = $this->pageOffset + $offsetDelta;
160 $currentText = substr($pageText, $pageOffset, strlen($this->originalText));
162 if ($currentText != $this->originalText) {
163 throw new BatcheditMatchApplyException('#' . $this->pageOffset);
167 $after = substr($pageText, $pageOffset + strlen($this->originalText));
169 $this->applied = TRUE;
171 return $before . $this->replacedText . $after;
178 $this->applied = FALSE;
185 return $this->applied;
192 return serialize(array($this->pageOffset, $this->originalText, $this->replacedText,
193 $this->contextBefore, $this->contextAfter, $this->marked, $this->applied));
200 list($this->pageOffset, $this->originalText, $this->replacedText,
201 $this->contextBefore, $this->contextAfter, $this->marked, $this->applied) = unserialize($data);
250 $this->id = $id;
251 $this->matches = array();
258 return $this->id;
265 $text = rawWiki($this->id);
281 'id' => $this->id,
291 $this->addMatch($text, $match[$i][0][1], $match[$i][0][0], $regexp, $replacement,
302 return $this->matches;
309 if (array_key_exists($offset, $this->matches)) {
310 $this->matches[$offset]->mark();
320 foreach ($this->matches as $match) {
336 foreach ($this->matches as $match) {
352 foreach ($this->matches as $match) {
367 $this->lock();
369 $text = rawWiki($this->id);
373 foreach ($this->matches as $match) {
380 saveWikiText($this->id, $text, $summary, $minorEdit);
381 unlock($this->id);
384 $this->rollbackMatches();
387 $error = new BatcheditMatchApplyException($this->id . $error->getArguments()[1]);
400 return serialize(array($this->id, $this->matches));
407 list($this->id, $this->matches) = unserialize($data);
414 $this->matches[$offset] = new BatcheditMatch($text, $offset, $matched, $regexp, $replacement, $contextChars, $contextLines);
421 if (auth_quickaclcheck($this->id) < AUTH_EDIT) {
422 throw new BatcheditAccessControlException($this->id);
425 $lockedBy = checklock($this->id);
428 throw new BatcheditPageLockedException($this->id, $lockedBy);
431 lock($this->id);
438 foreach ($this->matches as $match) {
463 $this->expirationTime = $expirationTime;
472 $this->prune();
504 if ($propsTime + $this->expirationTime < $now || $matchesTime + $this->expirationTime < $now) {
543 if ($fileInfo->getMTime() + $this->expirationTime < $now) {
549 $this->expire($id);
575 $this->id = $this->generateId();
576 $this->error = NULL;
577 $this->warnings = array();
578 $this->pages = array();
579 $this->matches = 0;
580 $this->edits = 0;
581 $this->cache = new BatcheditSessionCache($expirationTime);
588 $this->id = $id;
597 return $this->id;
604 $this->setId($request->getSessionId());
606 if (!$this->cache->isValid($this->id)) {
610 $properties = $this->loadArray('props');
612 if (!is_array($properties) || !empty(array_diff_assoc($properties, $this->getProperties($request, $config)))) {
616 $matches = $this->loadArray('matches');
622 list($warnings, $this->matches, $this->pages) = $matches;
624 $this->warnings = array_filter($warnings, function ($message) {
635 $this->saveArray('props', $this->getProperties($request, $config));
636 $this->saveArray('matches', array($this->warnings, $this->matches, $this->pages));
643 $this->cache->expire($this->id);
650 $this->error = new BatcheditErrorMessage($error->getArguments());
651 $this->pages = array();
652 $this->matches = 0;
653 $this->edits = 0;
661 $this->warnings[] = new BatcheditWarningMessage($warning->getArguments());
664 $this->warnings[] = new BatcheditWarningMessage(func_get_args());
672 if ($this->error != NULL) {
673 return array($this->error);
676 return $this->warnings;
683 $this->pages[$page->getId()] = $page;
684 $this->matches += count($page->getMatches());
691 return $this->pages;
698 if (!$this->cache->isValid($this->id)) {
702 $matches = $this->loadArray('matches');
711 return count($this->pages);
718 return $this->matches;
725 $this->edits += $edits;
732 return $this->edits;
770 $this->cache->save($this->id, $name, $array);
777 return $this->cache->load($this->id, $name);
789 $this->pages = $pages;
808 $this->cache = $cache;
815 if (!array_key_exists($pageId, $this->pages) || !array_key_exists($pageId, $this->cache)) {
819 $matches = $this->pages[$pageId]->getMatches();
820 $cache = $this->cache[$pageId]->getMatches();
826 if ($this->compareMatches($matches[$offset], $cache[$offset])) {
827 $this->pages[$pageId]->markMatch($offset);
856 if (array_key_exists($pageId, $this->pages)) {
857 $this->pages[$pageId]->markMatch($offset);
868 if (!array_key_exists($pageId, $this->pages)) {
872 if (array_key_exists($offset, $this->pages[$pageId]->getMatches())) {
873 $this->pages[$pageId]->markMatch($offset);
881 foreach ($this->pages[$pageId]->getMatches() as $match) {
903 $this->pages[$pageId]->markMatch($minOffset);
926 $this->fileName = BatcheditSessionCache::getFileName($sessionId, 'progress');
927 $this->operation = $operation;
928 $this->range = $range;
929 $this->progress = 0;
930 $this->lastSave = 0;
932 if ($this->operation != self::UNKNOWN && $this->range > 0) {
933 $this->save();
941 $this->progress += $progressDelta;
943 if (microtime(TRUE) > $this->lastSave + self::SAVE_PERIOD) {
944 $this->save();
952 $progress = @filesize($this->fileName);
969 $progress = max(round(self::SCALE * $this->progress / $this->range), 1);
971 if ($this->operation == self::APPLY) {
975 @file_put_contents($this->fileName, str_pad('', $progress, '.'));
977 $this->lastSave = microtime(TRUE);
989 // of the engine. For example, this can be time spent by DokuWiki itself, time for
1009 $this->session = $session;
1010 $this->startTime = time();
1011 $this->timeLimit = $this->getTimeLimit();
1018 $index = $this->getPageIndex($namespace);
1019 $progress = new BatcheditProgress($this->session->getId(), BatcheditProgress::SEARCH, count($index));
1023 $interrupted = $page->findMatches($regexp, $replacement, $limit - $this->session->getMatchCount(),
1027 $this->session->addPage($page);
1033 $this->session->addWarning('war_searchlimit');
1037 if ($this->isOperationTimedOut()) {
1038 $this->session->addWarning('war_timeout');
1042 if ($this->isOperationCancelled()) {
1043 $this->session->addWarning('war_cancelled');
1048 if ($this->session->getMatchCount() == 0) {
1049 $this->session->addWarning('war_nomatches');
1059 $policy = new BatcheditMarkPolicyVerifyBoth($this->session->getPages(), $this->session->getCachedPages());
1063 $policy = new BatcheditMarkPolicyVerifyMatched($this->session->getPages(), $this->session->getCachedPages());
1067 $policy = new BatcheditMarkPolicyVerifyOffset($this->session->getPages());
1071 $policy = new BatcheditMarkPolicyVerifyContext($this->session->getPages());
1086 $progress = new BatcheditProgress($this->session->getId(), BatcheditProgress::APPLY,
1087 array_reduce($this->session->getPages(), function ($marks, $page) {
1091 foreach ($this->session->getPages() as $page) {
1097 $this->session->addEdits($page->applyMatches($summary, $minorEdit));
1100 $this->session->addWarning($error);
1105 if ($this->isOperationTimedOut()) {
1106 $this->session->addWarning('war_timeout');
1110 if ($this->isOperationCancelled()) {
1111 $this->session->addWarning('war_cancelled');
1207 return time() - $this->startTime >= $this->timeLimit;
1214 return file_exists(BatcheditSessionCache::getFileName($this->session->getId(), 'cancel'));