Added ss_images to site_stats, to replace the slow count(*) query in Parser.php.
[lhc/web/wiklou.git] / includes / ImagePage.php
index 0e55156..98feeb4 100644 (file)
@@ -521,6 +521,14 @@ END
                                return;
                        }
                        $dbw->delete( 'image', array( 'img_name' => $image ) );
+
+                       if ( $dbw->affectedRows() ) {
+                               # Update site_stats
+                               $site_stats = $dbw->tableName( 'site_stats' );
+                               $dbw->query( "UPDATE $site_stats SET ss_images=ss_images-1", $fname );
+                       }
+                       
+
                        $res = $dbw->select( 'oldimage', array( 'oi_archive_name' ), array( 'oi_name' => $image ) );
 
                        # Purge archive URLs from the squid
@@ -552,7 +560,6 @@ END
                        /* Delete thumbnails and refresh image metadata cache */
                        $this->img->purgeCache();
 
-
                        $deleted = $image;
                }