public static function installAssets(CommandEvent $event) { $options = self::getOptions($event); $rootDir = realpath(__DIR__ . '/../../'); if (!$event->getIO()->askConfirmation('Would you like to install the third-party assets? [y/N] ', false)) { return; } $event->getIO()->write('Installing third-party assets.'); foreach ($options['assets'] as $package => $path) { $pkgDir = $rootDir . '/' . $path; $webDir = $rootDir . '/' . $options['foolfuuka-web-dir'] . '/foolfuuka/' . $package; $event->getIO()->write('+ ' . $package); if (file_exists($webDir)) { Util::delete($webDir); } if (is_dir($pkgDir)) { @mkdir($webDir, 0755, true); } else { @mkdir($webDir . '/../', 0755, true); } Util::copy($pkgDir, $webDir); } $event->getIO()->write('Finished installing third-party assets.'); }
/** * Removes the release from disk and database * * @param int $id The ID of the series */ public function delete($id) { // this method is constructed so if any part fails, // executing this function again will continue the deletion process $dc = $this->dc; // we can't get around fetching the series data, we need it to delete the directory $release_bulk = $this->getById($id); $dir = DOCROOT . 'foolslide/series/' . $release_bulk->series->id . '/' . $release_bulk->release->id; if (file_exists($dir)) { Util::delete($dir); } // delete all the pages related to this chapter from the database $dc->qb()->delete($dc->p('pages'))->where('release_id = :release_id')->setParameter(':release_id', $id)->execute(); // delete the release from the database $dc->qb()->delete($dc->p('releases'))->where('id = :id')->setParameter(':id', $id)->execute(); }