DataObjects/Images.php
authorleon <leon@roojs.com>
Mon, 18 Dec 2023 04:08:43 +0000 (12:08 +0800)
committerleon <leon@roojs.com>
Mon, 18 Dec 2023 04:08:43 +0000 (12:08 +0800)
DataObjects/Images.php

index a6816ad..6ff54cd 100644 (file)
@@ -238,33 +238,9 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
      * this tries to fix it.
      *
      */
-    function canFix() {
-        // look for the image in the folder, with matching id.
-        // this is problematic..
-        $fn = $this->getStoreName();
-        if (file_exists($fn . '-really-missing')) {
-            return false;
-        }
-        if (!file_exists(dirname($fn))) {
-            return false;
-        }
-        foreach( scandir(dirname($fn)) as $n) {
-            if (empty($n) || $n[0] == '.') {
-                continue;
-            }
-            $bits = explode('-', $n);
-            if ($bits[0] != $this->id) {
-                continue;
-            }
-            if (preg_match('/\.[0-9]+x[0-9]]+\.jpeg$/', $n)) {
-                continue;
-            }
-            copy(dirname($fn). '/'.  $n, $fn);
-            clearstatcache();
-            return true;
-        }
-        // fixme - flag it as bad
-        touch($fn . '-really-missing');
+    function canFix() 
+    {
+        return self::staticCanFix($this->id);
     }
 
     function staticCanFix($id)