Exemplo n.º 1
0
 protected static function search_write_connection_default()
 {
     $connection_set_first = '';
     foreach ($db_configs as $db => $config) {
         if (!static::check_is_db_config($config)) {
             continue;
         }
         // set first set db to master db.
         static::$_write_connection_default = $db;
         break;
     }
     if (empty(static::$_write_connection_default)) {
         \FuelException('Db setting error.');
     }
     return static::$_write_connection_default;
 }
Exemplo n.º 2
0
 public static function get_slug()
 {
     $main = date('ymd');
     $suffix = '';
     $slug = $main . $suffix;
     $max = \Config::get('news.max_articles_per_day');
     $i = 0;
     while (Model_News::check_exists4slug($slug)) {
         if ($i > $max) {
             throw \FuelException('Posted news exceeded the limit on par day.');
         }
         $suffix = \Util_string::get_next_alpha_str($suffix);
         $slug = $main . $suffix;
         $i++;
     }
     return $slug;
 }