예제 #1
0
 public function init()
 {
     parent::init();
     // Verify we're on the correct database
     //print_r(coreConfig::get('database_connection'));exit;
     $connectionInfo = coreConfig::get('database_connection');
     $this->verbose("Using database: %s", $connectionInfo['database']);
     $username = trim($this->getOption('u'));
     $raw_password = trim($this->getOption('p'));
     if (empty($username) || empty($raw_password)) {
         $this->throwError('Username or password is empty.');
     }
     $userid = UsersPeer::getUserId($username);
     if (false === $userid) {
         $this->throwError('User named "%s" not found.', $username);
     }
     $this->verbose("Userid: %s", $userid);
     $this->verbose("Set password to: %s", $raw_password);
     $this->updateUser($userid, array('raw_password' => $raw_password));
     // only with linked PunBB forum
     if ($this->args->flag('forum')) {
         if (coreConfig::get('app_path_to_punbb') !== null) {
             PunBBUsersPeer::setPassword($username, $raw_password);
         } else {
             $this->throwError('Forum password: "******" is not defined in environment "%s"', CORE_ENVIRONMENT);
         }
     }
     $this->verbose('Success!');
 }
예제 #2
0
 public function init()
 {
     parent::init();
     // Verify we're on the correct database
     //print_r(coreConfig::get('database_connection'));exit;
     $connectionInfo = coreConfig::get('database_connection');
     $this->verbose("Using database: %s", $connectionInfo['database']);
     $username = trim($this->getOption('username'));
     $raw_password = trim($this->getOption('password'));
     if (empty($username) || empty($raw_password)) {
         $this->throwError('Username or password is empty.');
     }
     if (UsersPeer::usernameExists($username)) {
         $this->throwError('That username already exists, foo!');
     }
     $this->createUser($username, $raw_password);
     $this->verbose('Success!');
 }
예제 #3
0
 public function init()
 {
     parent::init();
     $this->verbose('Done!');
 }