/**
  * Returns the meta data file instance used to store meta information.
  *
  * @param MOXMAN_Vfs_IFile $file File instance to get the meta data file for.
  * @return MOXMAN_Vfs_IFile Meta data file.
  */
 protected function getMetaFile(MOXMAN_Vfs_IFile $file)
 {
     $metaFile = null;
     if ($file->exists()) {
         $parent = $file->getParentFile();
         // Check if file isn't a root file
         if ($parent !== null) {
             $metaFile = $parent->getFileSystem()->getFile(MOXMAN_Util_PathUtils::combine($parent->getPath(), "meta.dat"));
         }
     }
     return $metaFile;
 }
 public function putFile(MOXMAN_Vfs_IFile $file)
 {
     $pdo = $this->getPdo();
     if (!$pdo) {
         return null;
     }
     $parentFile = $file->getParentFile();
     if (!$parentFile) {
         $info = array("name" => $file->getFileSystem()->getRootName(), "isDirectory" => true, "canRead" => $file->canRead(), "canWrite" => $file->canWrite(), "size" => 0, "lastModified" => 0);
         return $info;
     }
     $parentPath = $this->getIndexPath($parentFile);
     $attrs = $file->isDirectory() ? "d" : "-";
     $attrs .= $file->canRead() ? "r" : "-";
     $attrs .= $file->canWrite() ? "w" : "-";
     $attrs .= "-";
     $size = $file->getSize();
     $lastModified = $file->getLastModified();
     $numItems = $pdo->i("SELECT COUNT(mc_id) FROM moxman_cache WHERE mc_path = :mc_path AND mc_name = :mc_name", array("mc_path" => $parentPath, "mc_name" => $file->getName()));
     if ($numItems > 0) {
         $pdo->q("UPDATE moxman_cache SET mc_attrs = :mc_attrs, mc_size = :mc_size, " . "mc_last_modified = :mc_last_modified, mc_cached_time = :mc_cached_time WHERE mc_path = :mc_path AND mc_name = :mc_name", array("mc_attrs" => $attrs, "mc_size" => $file->isFile() ? $size : null, "mc_last_modified" => date('Y-m-d H:i:s', $lastModified), "mc_cached_time" => date('Y-m-d H:i:s', time()), "mc_path" => $parentPath, "mc_name" => $file->getName()));
         $this->log("[cache] putFile update");
     } else {
         $pdo->q("INSERT INTO moxman_cache(mc_path, mc_name, mc_extension, mc_attrs, mc_size, mc_last_modified, mc_cached_time) " . "VALUES(:mc_path, :mc_name, :mc_extension, :mc_attrs, :mc_size, :mc_last_modified, :mc_cached_time)", array("mc_path" => $parentPath, "mc_name" => $file->getName(), "mc_extension" => pathinfo($file->getName(), PATHINFO_EXTENSION), "mc_attrs" => $attrs, "mc_size" => $file->isFile() ? $size : null, "mc_last_modified" => date('Y-m-d H:i:s', $lastModified), "mc_cached_time" => date('Y-m-d H:i:s', time())));
         $this->log("[cache] putFile insert");
     }
     $info = array("name" => $file->getName(), "isDirectory" => $attrs[0] == 'd', "canRead" => $attrs[1] == 'r', "canWrite" => $attrs[2] == 'w', "size" => $size, "lastModified" => $lastModified);
     return $info;
 }