public function deleteroleAction() { $record = Role::find($this->getParam('id')); if ($record instanceof Role) { $record->delete(); } $this->alert('<b>Role deleted!</b>', 'green'); $this->redirectFromHere(array('action' => 'index', 'id' => NULL, 'csrf' => NULL)); }
// Force S3 enabled in development mode. define('DF_UPLOAD_URL', 'dev.pvlive.me'); $s3_client = \PVL\Service\AmazonS3::initClient(); $s3_bucket = \PVL\Service\AmazonS3::getBucket(); if (!$s3_client) { die('Amazon S3 could not be initialized! Halting remote import.'); } // Trigger download of the entire bucket to the local static folder. $s3_client->downloadBucket(DF_INCLUDE_STATIC, $s3_bucket); // Clean up S3 bucket. $remote_url = $remote_base . '/dev/cleanup?key=' . $api_key; // Prepare and execute mysqlimport command. $db_path_full = DF_INCLUDE_STATIC . DIRECTORY_SEPARATOR . $db_path; $db_config = $config->db->toArray(); $command_flags = array('-h ' . $db_config['host'], '-u ' . $db_config['user'], '-p' . $db_config['password'], $db_config['dbname']); $command = 'mysql ' . implode(' ', $command_flags) . ' < ' . $db_path_full; system($command); @unlink($db_path_full); @rmdir(dirname($db_path_full)); // Create initial user account. $user = new User(); $user->email = '*****@*****.**'; $user->setAuthPassword('password'); $user->name = 'Administrator'; $role = Role::find(1); if ($role instanceof Role) { $user->roles->add($role); $user->save(); } echo 'Database and Amazon S3 import complete.' . PHP_EOL; exit;