Есть ли способ заставить NHibernate выдать подсказку о взаимоблокировке?

Есть ли способ заставить NHibernate выдать подсказку о взаимоблокировке? например для SQL сервера "SET вот код

if(!file_exists("Manga"))
    {
      mkdir("Manga",0777);
      chmod("Manga",0777);
    }

    if(!file_exists("Manga/".$_POST['mangaName']))
    {
      mkdir("Manga/".$_POST['mangaName'],0777);
      chmod("Manga/".$_POST['mangaName'],0777);
    }
    if(!file_exists("Manga/".$_POST['mangaName']."/".$_POST['chapterName']))
    {
      mkdir("Manga/".$_POST['mangaName']."/".$_POST['chapterName'],0777);
      chmod("Manga/".$_POST['mangaName']."/".$_POST['chapterName'],0777);
    }

        $pathname = "Manga/".$_POST['mangaName']."/".$_POST['chapterName']."/";
        $chapterZip = new ZipArchive();


        if ($chapterZip->open($_FILES['chapterUpload']['tmp_name']) === true) { 

            for($i = 0; $i < $chapterZip->numFiles; $i++) {



      $chapterZip->extractTo($pathname, array($chapterZip->getNameIndex($i))); 
        chmod($pathname.$chapterZip->getNameIndex($i),0777);

        list($width, $height) = getimagesize($pathname.$chapterZip->getNameIndex($i));

            $imageLocation= "INSERT INTO imageLocation (imageLocation,imageWidth,imageHeight,chapterID) VALUES  ('"."Manga/".$_POST['mangaName']."/".$_POST['chapterName']."/".$chapterZip->getNameIndex($i).
            "',".$width.",".$height.",".$chapterID.")";
            getQuery($imageLocation,$l);                  
        }

       $chapterZip->close();
           $directories = glob($pathname.'*', GLOB_ONLYDIR);

       if ($directories !== FALSE) {

      foreach($directories as $directory) {

        $dir_handle = opendir($directory);
        while(($filename = readdir($dir_handle)) !== FALSE) {

          // Move all subdirectory contents to "Chapter Folder"
          if (rename($filename, $pathname.basename($filename)) === FALSE) {
           $errmsg0.= "Error moving file ($filename) \n";
                }
                else {
                $errmsg0.="You have successfully uploaded a manga chapter";
                }
          }
        }
      }
    }                
1
задан Community 23 May 2017 в 11:48
поделиться

2 ответа

LOL это не проблема разрешения :)
обходной путь:

while(($filename = readdir($dir_handle)) !== FALSE) {
  if ($filename[0] == ".") continue;

рассмотрите возможность использования современного glob() вместо древнего opendir.

1
ответ дан 2 September 2019 в 21:56
поделиться

Исключить . и .. из цикла rename, поскольку они являются псевдонимами, которые ссылаются на текущую папку и родительскую папку соответственно (помните, почему вы делаете cd .. на перейти в родительскую папку):

   while(($filename = readdir($dir_handle)) !== FALSE) {
      if ($filename != '.' && $filename != '..') {
         // Move all subdirectory contents to "Chapter Folder"
         if (rename($filename, $pathname.basename($filename)) === FALSE) {
           $errmsg0.= "Error moving file ($filename) \n";
            }
            else {
            $errmsg0.="You have successfully uploaded a manga chapter";
            }
         }
      }
    }
1
ответ дан 2 September 2019 в 21:56
поделиться
Другие вопросы по тегам:

Похожие вопросы: