@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Kick off indexing for File objects on creation

Summary: Ensures that newly-made `File` objects get indexed into the new ngrams index. Fixes T8788.

Test Plan:
- uploaded a file with daemons stopped; confirmed no new rows in ngrams table
- started daemons; confirmed indexing of previously-uploaded files happened
- uploaded a new file with daemons running; confirmed it got added to the index

Not sure how to test the changes to `PhabricatorFileUploadSource->writeChunkedFile()` and `PhabricatorChunkedFileStorageEngine->allocateChunks()`. I spent a few minutes trying to find their callers, but the first looks like it requires a Diffusion repo and the 2nd is only accessible via Conduit. I can test that stuff if necessary, but it's such a small change that I'm not worried about it.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T8788

Differential Revision: https://secure.phabricator.com/D17718

+10 -4
+1 -1
src/applications/files/engine/PhabricatorChunkedFileStorageEngine.php
··· 129 129 foreach ($chunks as $chunk) { 130 130 $chunk->save(); 131 131 } 132 - $file->save(); 132 + $file->saveAndIndex(); 133 133 $file->saveTransaction(); 134 134 135 135 return $file;
+8 -2
src/applications/files/storage/PhabricatorFile.php
··· 148 148 return parent::save(); 149 149 } 150 150 151 + public function saveAndIndex() { 152 + $this->save(); 153 + PhabricatorSearchWorker::queueDocumentForIndexing($this->getPHID()); 154 + return $this; 155 + } 156 + 151 157 public function getMonogram() { 152 158 return 'F'.$this->getID(); 153 159 } ··· 234 240 235 241 $new_file->readPropertiesFromParameters($params); 236 242 237 - $new_file->save(); 243 + $new_file->saveAndIndex(); 238 244 239 245 return $new_file; 240 246 } ··· 390 396 // Do nothing 391 397 } 392 398 393 - $file->save(); 399 + $file->saveAndIndex(); 394 400 395 401 return $file; 396 402 }
+1 -1
src/applications/files/uploadsource/PhabricatorFileUploadSource.php
··· 145 145 } 146 146 147 147 $file = PhabricatorFile::newChunkedFile($engine, $length, $parameters); 148 - $file->save(); 148 + $file->saveAndIndex(); 149 149 150 150 $rope = $this->getRope(); 151 151