Example #1
0
 /**
  * Returns whether the report can be stored in the associated Omeka_Storage object
  *
  * @param array &$errors The array of errors for why a file cannot store
  * @return bool whether the report can be stored in the associated Omeka_Storage object  
  */
 public function canStore(&$errors)
 {
     // this is a hack because Omeka_Storage_Adapter_Filesystem
     // does not correctly implement canStore when the localDir
     // has been changed. It also offers no way to remove the subDirs
     // we don't use or care about.
     // So we must directly test whether the directory we plan to write to is writeable
     $ad = $this->_storage->getAdapter();
     if ($ad instanceof Omeka_Storage_Adapter_Filesystem) {
         $opt = $ad->getOptions();
         $localDir = $opt['localDir'];
         $absPath = $localDir . '/' . $this->_storagePrefixDir;
         // this reimplements Omeka_Storage_Adapter_Filesystem::_getAbsPath
         $result = is_writable($absPath);
         if (!$result) {
             if (!$errors) {
                 $errors = array();
             }
             $errors[] = __("Make sure that %s is exists and is writeable.", $absPath);
         }
         return $result;
     }
     return $this->_storage->canStore();
 }