Contao\Folder::purge PHP Method

purge() public method

Purge the folder
public purge ( )
    public function purge()
    {
        $this->Files->rrdir($this->strFolder, true);
        // Update the database
        if (\Dbafs::shouldBeSynchronized($this->strFolder)) {
            $objFiles = \FilesModel::findMultipleByBasepath($this->strFolder . '/');
            if ($objFiles !== null) {
                while ($objFiles->next()) {
                    $objFiles->delete();
                }
            }
            \Dbafs::updateFolderHashes($this->strFolder);
        }
    }

Usage Example

Example #1
0
 /**
  * Purge the data
  */
 public function purge()
 {
     // Purge the data
     Database::getInstance()->query("TRUNCATE TABLE tl_vimeo_cache");
     // Purge the images
     $folder = new \Folder(static::$imagesFolder);
     $folder->purge();
     // Log the action
     System::log('Purged the Vimeo cache', __METHOD__, TL_CRON);
 }
All Usage Examples Of Contao\Folder::purge