diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-01-13 14:08:52 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-01-13 14:08:52 +0300 |
commit | 75bb68ebdf3280c985efc7ded4fd4e0c2118fbb6 (patch) | |
tree | 24ea5b5e2e37a294a26c6515dd59ab83659d4b25 /lib/Model | |
parent | 93bf15aa2ba85183387b3056586211e1e1d64d5c (diff) |
index cleaning
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/Index.php | 17 | ||||
-rw-r--r-- | lib/Model/ProviderIndexes.php | 18 |
2 files changed, 15 insertions, 20 deletions
diff --git a/lib/Model/Index.php b/lib/Model/Index.php index f25da7e..9924871 100644 --- a/lib/Model/Index.php +++ b/lib/Model/Index.php @@ -30,11 +30,14 @@ class Index implements \JsonSerializable { const INDEX_OK = 1; const INDEX_IGNORE = 2; + const INDEX_META = 4; const INDEX_CONTENT = 8; const INDEX_FULL = 12; const INDEX_REMOVE = 16; - const INDEX_FAILED = 32; + + const INDEX_DONE = 32; + const INDEX_FAILED = 64; const ERROR_FAILED = 1; const ERROR_FAILED2 = 2; @@ -126,12 +129,22 @@ class Index implements \JsonSerializable { /** * @param int $status * - * @return int + * @return bool */ public function isStatus($status) { return ((int)$status & $this->getStatus()); } + /** + * @param int $status + */ + public function unsetStatus($status) { + if (!$this->isStatus($status)) { + return; + } + + $this->status -= $status; + } /** * @param int $err diff --git a/lib/Model/ProviderIndexes.php b/lib/Model/ProviderIndexes.php index 510666c..2915181 100644 --- a/lib/Model/ProviderIndexes.php +++ b/lib/Model/ProviderIndexes.php @@ -62,22 +62,4 @@ class ProviderIndexes { } - public function isDocumentIndexUpToDate(IndexDocument $document) { - $index = $this->getIndex($document->getId()); - if ($index === null) { - $index = new Index($document->getProviderId(), $document->getId()); - $index->setStatus(Index::INDEX_FULL); - $index->setLastIndex(); - } - - $document->setIndex($index); - - if ($index->getStatus() !== Index::INDEX_OK) { - return false; - } - - return ($index->getLastIndex() >= $document->getModifiedTime()); - } - - }
\ No newline at end of file |