Skip to content

Commit

Permalink
Bug SAFeSEA#31, fixes to app/cli and DBConnection [iet:10299536]
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Feb 4, 2018
1 parent 8635261 commit 845e199
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 6 additions & 5 deletions app/cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
$result = oeApp::createTables();
}
catch (\PDOException $ex) {
Clio::error('Database Error: ' . $ex->getMessage()); // Table exists ??
Clio::error('Database error. ' . $ex->getMessage()); // Table exists ??
exit( 1 );
}
Clio::output("\n" . '>> OK. Tables created. Schema: ' . oeApp::SCHEMA_FILE);
Expand All @@ -71,18 +71,19 @@
$users = oeApp::config( 'users' );
print_r( $users );

error_reporting( E_ALL & ~E_WARNING );
$strong = new Strong\Strong([ 'provider' => 'PDO', 'pdo' => ORM::get_db(), ]);
foreach ($users as $user) {
try {
$result = oeApp::createUser( $user );
$res = oeApp::createUser( $user );
}
catch (\PDOException $ex) {
print_r($ex->getMessage());
Clio::error('Database error. ' .$ex->getMessage());
exit( 1 );
}
Clio::output('>> OK. User added, username: ', $user->username);
print_r( $u->get( 'username' ), $u->get( 'id' ) );
print_r($res->user->get( 'username' ), $res->user->get( 'id' ));
}

exit;
}

Expand Down
6 changes: 5 additions & 1 deletion app/utils/DBConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ public static function createUser( $user )
$u->group_id = 1; // $gid;

// try {
return $u->save();
$result = $u->save();
/* }
catch (\PDOException $ex) {
print_r($ex->getMessage());
} */
return (object) [
'result' => $result,
'user' => $u,
];
}

public static function hashPassword( $password )
Expand Down

0 comments on commit 845e199

Please sign in to comment.