cleanup and bugfix on bulk actions
This commit is contained in:
@@ -56,9 +56,6 @@ class Initializer {
|
|||||||
\ORM::configure('username', Env::$db_username);
|
\ORM::configure('username', Env::$db_username);
|
||||||
\ORM::configure('password', Env::$db_password);
|
\ORM::configure('password', Env::$db_password);
|
||||||
\ORM::configure('logging', WP_DEBUG);
|
\ORM::configure('logging', WP_DEBUG);
|
||||||
\ORM::configure('logger', function($query, $time) {
|
|
||||||
error_log($query);
|
|
||||||
});
|
|
||||||
\ORM::configure('driver_options', array(
|
\ORM::configure('driver_options', array(
|
||||||
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||||
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET TIME_ZONE = "+00:00"'
|
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET TIME_ZONE = "+00:00"'
|
||||||
|
@@ -109,6 +109,7 @@ class Model extends \Sudzy\ValidModel {
|
|||||||
static function bulkAction($orm, $callback = false) {
|
static function bulkAction($orm, $callback = false) {
|
||||||
$total = $orm->count();
|
$total = $orm->count();
|
||||||
|
|
||||||
|
if($total > 0) {
|
||||||
$models = $orm->select('id')
|
$models = $orm->select('id')
|
||||||
->offset(null)
|
->offset(null)
|
||||||
->limit(null)
|
->limit(null)
|
||||||
@@ -121,6 +122,7 @@ class Model extends \Sudzy\ValidModel {
|
|||||||
if(is_callable($callback)) {
|
if(is_callable($callback)) {
|
||||||
$callback($ids);
|
$callback($ids);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user