Ejemplo n.º 1
0
 /**
  * Executes the command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface   $input
  * @param  \Symfony\Component\Console\Output\OutputInterface $output
  * @return object|\Symfony\Component\Console\Output\OutputInterface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->addLibrary('wildfire');
     $template = $this->renderer->render('Libraries/Wildfire.tpl');
     $wildfire = new File(APPPATH . 'libraries/Wildfire.php');
     $wildfire->putContents($template);
     $wildfire->close();
     Tools::ignite();
     $message = 'Wildfire is now installed successfully!';
     return $output->writeln('<info>' . $message . '</info>');
 }
Ejemplo n.º 2
0
 /**
  * Executes the command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return object|\Symfony\Component\Console\Output\OutputInterface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     system('composer require doctrine/orm');
     $cli = $this->renderer->render('DoctrineCLI.tpl');
     $doctrine = new File(APPPATH . 'libraries/Doctrine.php');
     $template = $this->renderer->render('Libraries/Doctrine.tpl');
     $vendor = realpath('vendor');
     // Modifies the contents of vendor/bin/doctrine.php, creates the
     // Doctrine library and creates a "proxies" directory for lazy loading.
     file_put_contents($vendor . '/bin/doctrine.php', $cli);
     file_put_contents($vendor . '/doctrine/orm/bin/doctrine.php', $cli);
     $doctrine->putContents($template);
     $doctrine->close();
     $this->addLibrary('doctrine');
     if (!is_dir(APPPATH . 'models/proxies')) {
         mkdir(APPPATH . 'models/proxies');
         chmod(APPPATH . 'models/proxies', 0777);
     }
     $abstractCommandPath = $vendor . '/doctrine/orm/lib/Doctrine/ORM/' . 'Tools/Console/Command/SchemaTool/AbstractCommand.php';
     // Includes the Base Model class in Doctrine CLI
     $abstractCommand = file_get_contents($abstractCommandPath);
     $search = 'use Doctrine\\ORM\\Tools\\SchemaTool;';
     $replace = $search . "\n" . 'include BASEPATH . \'core/Model.php\';';
     $contents = $abstractCommand;
     $schemaTool = 'use Doctrine\\ORM\\Tools\\SchemaTool;';
     $coreModel = 'include BASEPATH . \'core/Model.php\';';
     if (strpos($abstractCommand, $schemaTool) !== false) {
         if (strpos($abstractCommand, $coreModel) === false) {
             $contents = str_replace($search, $replace, $abstractCommand);
         }
     }
     file_put_contents($abstractCommandPath, $contents);
     Tools::ignite();
     $message = 'Doctrine ORM is now installed successfully!';
     return $output->writeln('<info>' . $message . '</info>');
 }
Ejemplo n.º 3
0
 /**
  * Executes the command.
  * 
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return object|OutputInterface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /**
      * Add Wildfire.php to the "libraries" directory
      */
     $autoload = file_get_contents(APPPATH . 'config/autoload.php');
     preg_match_all('/\\$autoload\\[\'libraries\'\\] = array\\((.*?)\\)/', $autoload, $match);
     $libraries = explode(', ', end($match[1]));
     if (!in_array('\'wildfire\'', $libraries)) {
         array_push($libraries, '\'wildfire\'');
         $libraries = array_filter($libraries);
         $autoload = preg_replace('/\\$autoload\\[\'libraries\'\\] = array\\([^)]*\\);/', '$autoload[\'libraries\'] = array(' . implode(', ', $libraries) . ');', $autoload);
         $file = fopen(APPPATH . 'config/autoload.php', 'wb');
         file_put_contents(APPPATH . 'config/autoload.php', $autoload);
         fclose($file);
     }
     $file = fopen(APPPATH . 'libraries/Wildfire.php', 'wb');
     $wildfire = $this->renderer->render('Libraries/Wildfire.template');
     file_put_contents(APPPATH . 'libraries/Wildfire.php', $wildfire);
     fclose($file);
     Tools::ignite();
     $message = 'Wildfire is now installed successfully!';
     return $output->writeln('<info>' . $message . '</info>');
 }
Ejemplo n.º 4
0
 /**
  * Executes the command.
  * 
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return object|OutputInterface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     system('composer require doctrine/orm');
     $cli = $this->renderer->render('DoctrineCLI.template');
     $library = $this->renderer->render('Libraries/Doctrine.template');
     /**
      * Modify the contents of vendor/bin/doctrine.php,
      * create the Doctrine library and create a "proxies"
      * directory for lazy loading
      */
     file_put_contents(VENDOR . 'bin/doctrine.php', $cli);
     file_put_contents(VENDOR . 'doctrine/orm/bin/doctrine.php', $cli);
     $file = fopen(APPPATH . 'libraries/Doctrine.php', 'wb');
     file_put_contents(APPPATH . 'libraries/Doctrine.php', $library);
     fclose($file);
     $autoload = file_get_contents(APPPATH . 'config/autoload.php');
     preg_match_all('/\\$autoload\\[\'libraries\'\\] = array\\((.*?)\\)/', $autoload, $match);
     $libraries = explode(', ', end($match[1]));
     if (!in_array('\'doctrine\'', $libraries)) {
         array_push($libraries, '\'doctrine\'');
         if (in_array('\'database\'', $libraries)) {
             $position = array_search('\'database\'', $libraries);
             unset($libraries[$position]);
         }
         $libraries = array_filter($libraries);
         $autoload = preg_replace('/\\$autoload\\[\'libraries\'\\] = array\\([^)]*\\);/', '$autoload[\'libraries\'] = array(' . implode(', ', $libraries) . ');', $autoload);
         $file = fopen(APPPATH . 'config/autoload.php', 'wb');
         file_put_contents(APPPATH . 'config/autoload.php', $autoload);
         fclose($file);
     }
     if (!is_dir(APPPATH . 'models/proxies')) {
         mkdir(APPPATH . 'models/proxies');
         chmod(APPPATH . 'models/proxies', 0777);
     }
     /*
      * Include the Base Model class in Doctrine CLI
      */
     $abstractCommand = file_get_contents(VENDOR . 'doctrine/orm/lib/Doctrine/' . 'ORM/Tools/Console/Command/' . 'SchemaTool/AbstractCommand.php');
     $search = 'use Doctrine\\ORM\\Tools\\SchemaTool;';
     $replace = $search . "\n" . 'include BASEPATH . \'core/Model.php\';';
     $contents = $abstractCommand;
     $schemaTool = 'use Doctrine\\ORM\\Tools\\SchemaTool;';
     $coreModel = 'include BASEPATH . \'core/Model.php\';';
     if (strpos($abstractCommand, $schemaTool) !== false) {
         if (strpos($abstractCommand, $coreModel) === false) {
             $contents = str_replace($search, $replace, $abstractCommand);
         }
     }
     file_put_contents(VENDOR . 'doctrine/orm/lib/Doctrine/' . 'ORM/Tools/Console/Command/' . 'SchemaTool/AbstractCommand.php', $contents);
     Tools::ignite();
     $message = 'Doctrine ORM is now installed successfully!';
     return $output->writeln('<info>' . $message . '</info>');
 }