diff options
Diffstat (limited to 'cli_util.php')
-rwxr-xr-x | cli_util.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cli_util.php b/cli_util.php index 0c42bb5..e883ae7 100755 --- a/cli_util.php +++ b/cli_util.php @@ -4,12 +4,13 @@ namespace cli_util; use cli; +use pages; use posts; +use tags; use uploads; -use pages; -use config; require_once __DIR__.'/init.php'; +require_once 'lib/stored_config.php'; $cli = new cli(__NAMESPACE__); $cli->run(); @@ -24,18 +25,18 @@ function admin_reset(): void { if (trim($pwd1) == '') cli::die("Password can not be empty"); - if (!config::set('admin_pwd', salt_password($pwd1))) + if (!scSet('admin_pwd', salt_password($pwd1))) cli::die("Database error"); } function admin_check(): void { - $pwd = config::get('admin_pwd'); + $pwd = scGet('admin_pwd'); echo is_null($pwd) ? "Not set" : $pwd; echo "\n"; } function blog_erase(): void { - $db = getDb(); + $db = DB(); $tables = ['posts', 'posts_tags', 'tags']; foreach ($tables as $t) { $db->query("TRUNCATE TABLE $t"); @@ -43,14 +44,14 @@ function blog_erase(): void { } function tags_recount(): void { - $tags = posts::getAllTags(true); + $tags = tags::getAll(true); foreach ($tags as $tag) - posts::recountPostsWithTag($tag->id); + posts::tagsRecountPosts($tag->id); } function posts_html(): void { $kw = ['include_hidden' => true]; - $posts = posts::getPosts(0, posts::getPostsCount(...$kw), ...$kw); + $posts = posts::getList(0, posts::getCount(...$kw), ...$kw); foreach ($posts as $p) { $p->updateHtml(); $p->updateText(); @@ -59,7 +60,7 @@ function posts_html(): void { function posts_images(): void { $kw = ['include_hidden' => true]; - $posts = posts::getPosts(0, posts::getPostsCount(...$kw), ...$kw); + $posts = posts::getList(0, posts::getCount(...$kw), ...$kw); foreach ($posts as $p) { $p->updateImagePreviews(true); } @@ -77,7 +78,6 @@ function add_files_to_uploads(): void { if (!file_exists($path)) cli::die("file $path doesn't exists"); $name = basename($path); - $ext = extension($name); $id = uploads::add($path, $name, ''); echo "upload id: $id\n"; } |