| 31 |
*/ |
*/ |
| 32 |
public function rescanGallery() { |
public function rescanGallery() { |
| 33 |
$arGalleries = variable_get('fg_galleries', array()); |
$arGalleries = variable_get('fg_galleries', array()); |
| 34 |
|
$storage = $this->getStorageEngine(); |
| 35 |
|
|
| 36 |
foreach ($arGalleries as $gallery) { |
foreach ($arGalleries as $gallery) { |
| 37 |
$path = utf8_decode($gallery['fg_path']); |
$path = utf8_decode($gallery['fg_path']); |
| 38 |
if (!is_dir($path)) { |
if (!is_dir($path)) { |
| 41 |
// Get current file list hierarchy |
// Get current file list hierarchy |
| 42 |
$files = $this->exploreDir($path, TRUE); |
$files = $this->exploreDir($path, TRUE); |
| 43 |
|
|
|
// Delete non-existent files |
|
|
//$this->deletePics(); |
|
|
|
|
| 44 |
// Process the files |
// Process the files |
| 45 |
$FgImgContainer = array(); |
$FgImgContainer = array(); |
| 46 |
$this->processFiles($files, $FgImgContainer); |
$this->processFiles($files, $FgImgContainer); |
| 47 |
|
|
| 48 |
$storage = $this->getStorageEngine(); |
|
| 49 |
$storage->storeImages($FgImgContainer); |
$storage->storeImages($FgImgContainer); |
| 50 |
} |
} |
| 51 |
// Check for orphan images/folders and fix it |
|
| 52 |
//$this->checkHierarchy(); |
$storage->removeDeletedFiles(); |
| 53 |
} |
} |
| 54 |
|
|
| 55 |
/** |
/** |
| 167 |
return $bc; |
return $bc; |
| 168 |
} |
} |
| 169 |
|
|
|
/** |
|
|
* removing a file that has been deleted from the file system |
|
|
* @param $file |
|
|
* @return unknown_type |
|
|
*/ |
|
|
public function deleteFile($file) { |
|
|
$storage = $this->getStorageEngine(); |
|
|
$storage->deleteFile($file); |
|
|
} |
|
| 170 |
} |
} |