@@ -310,16 +310,24 @@ private function _setAction($action) {
310310 *
311311 * @since 1.0.5
312312 *
313- * @param string $action
314- * @param string $state
313+ * @param string $action
314+ * @param string $state
315+ * @param boolean $addAction
315316 */
316- private function _doAction ($ action , $ state ) {
317+ private function _doAction ($ action , $ state , $ addAction = false ) {
318+
319+ $ that = self ::getInstance ();
320+
321+ if ($ addAction && isset ($ that ->module ['hooks ' ][$ action ])) {
322+
323+ Hook::addAction ($ that ->module ['hooks ' ][$ action ]);
324+ }
317325
318326 Hook::doAction ($ action );
319327
320- $ this ->_setAction ('' );
328+ $ that ->_setAction ('' );
321329
322- $ this ->_setState ($ state );
330+ $ that ->_setState ($ state );
323331 }
324332
325333 /**
@@ -400,7 +408,7 @@ public static function changeState($moduleName = null) {
400408
401409 $ that ->_setState ($ state );
402410
403- $ that ->_doAction ($ action , $ state );
411+ $ that ->_doAction ($ action , $ state, true );
404412
405413 return $ state ;
406414 }
@@ -416,7 +424,7 @@ public static function changeState($moduleName = null) {
416424 *
417425 * @return boolean
418426 */
419- private function _deleteDir ($ modulePath , $ deleteAll ) {
427+ public static function _deleteDir ($ modulePath , $ deleteAll ) {
420428
421429 $ that = self ::getInstance ();
422430
@@ -431,16 +439,9 @@ private function _deleteDir($modulePath, $deleteAll) {
431439
432440 foreach ($ objects as $ object ) {
433441
434- if ($ object == '. ' && $ object == '.. ' ) {
442+ if ($ object === '. ' || $ object === '.. ' ) { continue ; }
435443
436- continue ;
437- }
438-
439- if (is_dir ($ modulePath . $ object . App::DS )) {
440-
441- $ that ->_deleteDir ($ modulePath . $ object , $ deleteAll );
442-
443- } else {
444+ if (is_file ($ modulePath . $ object )) {
444445
445446 if (!$ deleteAll ) {
446447
@@ -450,8 +451,12 @@ private function _deleteDir($modulePath, $deleteAll) {
450451 }
451452 }
452453
453- unlink ($ modulePath . App::DS . $ object );
454- }
454+ unlink ($ modulePath . $ object );
455+
456+ } else {
457+
458+ $ that ->_deleteDir ($ modulePath .$ object .App::DS , $ deleteAll );
459+ }
455460 }
456461
457462 if (!$ deleteAll ) {
0 commit comments