@@ -23,8 +23,8 @@ class Installer
2323 */
2424 public static function postInstall (Event $ event = null )
2525 {
26+ // Copy CodeIgniter files
2627 self ::recursiveCopy ('vendor/codeigniter/framework/application ' , 'application ' );
27-
2828 mkdir (static ::DOCROOT , 0755 );
2929 copy ('vendor/codeigniter/framework/index.php ' , static ::DOCROOT . '/index.php ' );
3030 copy ('dot.htaccess ' , static ::DOCROOT . '/.htaccess ' );
@@ -52,23 +52,39 @@ public static function postInstall(Event $event = null)
5252 '$config[ \'composer_autoload \'] = realpath(APPPATH . \'../vendor/autoload.php \'); ' ,
5353 $ contents
5454 );
55+
5556 // Set 'index_page' blank
5657 $ contents = str_replace (
5758 '$config[ \'index_page \'] = \'index.php \'; ' ,
5859 '$config[ \'index_page \'] = \'\'; ' ,
5960 $ contents
6061 );
6162 file_put_contents ($ file , $ contents );
62-
63+
64+ // Update composer.json
6365 copy ('composer.json.dist ' , 'composer.json ' );
66+
67+ // Run composer update
68+ self ::composerUpdate ();
69+
70+ // Show message
71+ self ::showMessage ($ event );
72+
73+ // Delete unneeded files
74+ self ::deleteSelf ();
75+ }
76+
77+ private static function composerUpdate ()
78+ {
79+ passthru ('composer update ' );
6480 }
6581
6682 /**
6783 * Composer post install script
6884 *
6985 * @param Event $event
7086 */
71- public static function showMessage (Event $ event = null )
87+ private static function showMessage (Event $ event = null )
7288 {
7389 $ io = $ event ->getIO ();
7490 $ io ->write ('================================================== ' );
@@ -83,8 +99,6 @@ public static function showMessage(Event $event = null)
8399 $ io ->write ('<info>Above command will show help message.</info> ' );
84100 $ io ->write ('See <https://github.com/kenjis/codeigniter-composer-installer> for details ' );
85101 $ io ->write ('================================================== ' );
86-
87- self ::deleteSelf ();
88102 }
89103
90104 private static function deleteSelf ()
0 commit comments