protected function _before_delete($options) { $goods_id = $options['where']['goods_id']; //删除商品自身的图片 $imgs = $this->field('goods_ori,goods_img,goods_thumb')->find($goods_id); //一维数组 //如果有图片就调用删除图片的方法 if ($imgs['goods_ori']) { deleteImages($imgs); } //删除商品的属性 M('GoodsAttr')->where("goods_id={$goods_id}")->delete(); //删除相册的图片 $photoimgs = M('GoodsPhoto')->field('photo_ori,photo_thumb')->where("goods_id={$goods_id}")->select(); //二维数组 //如果有图片则遍历删除 if ($photoimgs) { foreach ($photoimgs as $v) { deleteImages($v); } } //删除相册表中的数据记录 M('GoodsPhoto')->where("goods_id={$goods_id}")->delete(); }
regenerateImages(); HTML_RSGALLERY::RSGalleryFooter(); break; case 'executeRegenerateImages': executeRegenerateImages(); break; /* Consolidate database calls */ /* Consolidate database calls */ case 'consolidateDB': consolidateDB(); break; case 'createImages': createImages(); break; case 'deleteImages': deleteImages(); break; case 'createDbEntries': createDbEntries(); break; /* Optimize DB calls*/ /* Optimize DB calls*/ case 'optimizeDB': optimizeDB(); break; /* Migration calls */ /* Migration calls */ case 'showMigration': HTML_RSGALLERY::RSGalleryHeader('cpanel', JText::_('Migration options')); showMigration(); HTML_RSGALLERY::RSGalleryFooter();
function deletePortfolio($id) { $resource = readPortfolioImageDb($id); if (!$_SESSION["read-only-user"] && $resource) { deleteImages($id); generateGalleryDb(); } return $resource ?: restError(404); }