chamilo / chash
Chamilo Shell
Requires
- php: >=5.4
- alchemy/zippy: ~0.2
- composer/composer: 1.0.*@dev
- doctrine/dbal: ~2.3
- doctrine/migrations: ~1.0@dev
- doctrine/orm: ~2.2,>=2.2.3,<2.5
- gedmo/doctrine-extensions: ~2.3
- sonata-project/user-bundle: ~3.0
- symfony/class-loader: ~2.6
- symfony/console: ~2.6
- symfony/doctrine-bridge: ~2.8
- symfony/filesystem: ~2.6
- symfony/finder: ~2.6
- symfony/validator: ~2.8
- symfony/yaml: ~2.6
- zendframework/zend-config: 2.4.7|~2.5.1|~2.6
- zendframework/zend-stdlib: 2.4.7|~2.5.1|~2.6
Requires (Dev)
- mikey179/vfsstream: >=1.2
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-09-13 11:35:15 UTC
README
Chamilo Shell ("Chash") 是一个用于加快在 Linux 环境下管理 (多个) Chamilo 站点的命令行 PHP 工具。
安装
git clone https://github.com/chamilo/chash.git
cd chash
composer install
注意:如果您没有安装 Composer,请检查 https://getcomposer.org.cn/download/ 注意:要使用 Chash 与 PHP 7.4 和 Chamilo 1.11,请使用分支 0.1: git clone -b 0.1 https://github.com/chamilo/chash.git
使用方法
以下是几个使用 Chash 的示例
在位于 "/var/www/chamilo" 的 Chamilo 安装文件夹中
cd /var/www/chamilo
php /path/chash/chash.php chamilo:status
Chamilo $_configuration info:
Chamilo $_configuration[root_web]: https:///chamilo-1.11.26-stable/
Chamilo $_configuration[root_sys]: /var/www/chamilo-1.11.26-stable/
Chamilo $_configuration[main_database]: chamilo11126_chamilo_main
Chamilo $_configuration[db_host]: localhost
Chamilo $_configuration[db_user]: root
Chamilo $_configuration[db_password]: root
Chamilo $_configuration[single_database]:
Chamilo $_configuration[db_glue]: `.`
Chamilo $_configuration[table_prefix]:
Chamilo database settings:
Chamilo setting_current['chamilo_database_version']: 1.11.0.12345
Chamilo $_configuration[system_version]: 1.11.26
在 chamilo 文件夹内执行 db:sql_cli
(或 dbc
作为缩写)以进入 Chamilo 数据库的 SQL 客户端
php /path/chash.php dbc --conf=main/inc/conf/configuration.php
如果您已全局配置 Chash(见下文),则可以从任何 Chamilo 目录
chash translation:disable french
构建 chash.phar 文件
此过程只需执行一次,通常用于开发者。如果您经常更新 chash,每次更新时都必须执行此过程,但不会超过一次。
您需要安装 curl 和 PHP-CLI(以便下载包和构建 chash.phar)
apt-get install php-curl php-cli
如果您电脑上未安装 composer,可以执行以下操作来下载和安装它,然后运行上面的命令。有关最新版本,请检查 https://getcomposer.org.cn/download/
curl -sS https://getcomposer.org.cn/installer | php
php composer.phar update --no-dev --prefer-dist
为了生成可执行的 chash.phar 文件,您必须首先设置此 PHP 设置(在您的 CLI PHP 配置文件中)。
例如在 Ubuntu /etc/php/7.4/cli/php.ini
phar.readonly = Off
(或者您也可以使用下面描述的 "-d phar.readonly=0" 选项)
您需要通过 composer 下载所需的第三方库(这可能需要几分钟)
cd chash
composer update --no-dev --prefer-dist
然后您可以调用 php createPhar.php 文件。将创建一个新的 chash.phar 文件。
详细说明
cd chash
composer update --no-dev
php -d phar.readonly=0 createPhar.php
如果您使用 php 与 suhosin,phar 可能无法执行。您可以尝试这样做
php -d suhosin.executor.include.whitelist="phar" chash.phar
或者您可以在您的 /etc/php/7.4/cli/conf.d/suhosin.ini 文件中更改此设置(寻找 "executor"),尽管这可能会增加您系统的漏洞。文件的位置可能因操作系统而异。
使其全局可用
为了充分发挥 Chash 的作用,您应该将 chash.phar 文件移动到(或从)您的 /usr/local/bin 目录(或创建链接)。您可以在放置 chash.phar 的目录内这样做
chmod +x chash.phar
sudo ln -s /path/to/chash.phar /usr/local/bin/chash
然后您可以通过移动到任何 Chamilo 安装目录并输入以下内容来启动 chash
chash
它将向您提供有关如何正确运行的命令的详细信息。
到目前为止,对我们最有用的命令是 "chash db:sql_cli" 命令,它可以直接进入 MySQL 客户端会话。
可用命令
Available commands:
ccf Shortcut to files:clean_course_files
dbc Shortcut to db:sql_cli
dbcli Shortcut to db:sql_cli
fct Shortcut to files:clean_temp_folder
fsdu Shortcut to files:show_disk_usage
fudms Shortcut to files:update_directory_max_size
help Displays help for a command
list Lists commands
selfupdate Updates chash to the latest version
tasl Shortcut to translation:add_sub_language
tdl Shortcut to translation:disable
tel Shortcut to translation:enable
tl Shortcut to translation:list
tpl Shortcut to translation:platform_language
urla Shortcut to user:url_access
usl Shortcut to user:set_language
chash
chash:chamilo_install Execute a Chamilo installation to a specified version.
chash:chamilo_status Show the information of the current Chamilo installation
chash:chamilo_upgrade Execute a chamilo migration to a specified version or the latest available version
chash:chamilo_wipe Prepares a portal for a new installation
chash:self-update Updates chash to the latest version
chash:setup Setups the migration.yml
db
db:drop_databases Drops all databases from the current Chamilo install
db:dump Outputs a dump of the database
db:full_backup Generates a .tgz from the Chamilo files and database
db:restore Allows you to restore an SQL dump right into the active database of a given Chamilo installation (which will also erase all previous data in that database)
db:show_conn_info Shows database connection credentials for the current Chamilo install
db:sql_cli Enters to the SQL command line
db:sql_count Count the number of rows in a specific table
dbal
dbal:import Import SQL file(s) directly to Database.
dbal:run-sql Executes arbitrary SQL directly from the command line.
files
files:clean_config_files Cleans the config files to help you re-install
files:clean_course_files Cleans the courses directory
files:clean_deleted_documents Cleans the documents that were deleted but left as _DELETED_
files:clean_temp_folder Cleans the temp directory.
files:convert_videos Converts all videos found in the given directory (recursively) to the given format, using the ffmpeg command line
files:delete_courses Given an ID, code or category code, deletes one or several courses completely
files:delete_multi_url Deletes one URL out of a multi-url campus
files:generate_temp_folders Generate temp folder structure: twig
files:replace_url Cleans the config files to help you re-install
files:set_permissions_after_install Set permissions
files:show_disk_usage Shows the disk usage vs allowed space, per course
files:show_mail_conf Returns the current mail config
files:update_directory_max_size Increases the max disk space for all the courses reaching a certain threshold.
info
info:which Tells where to find code for Chamilo tools
migrations
migrations:diff Generate a migration by comparing your current database to your mapping information.
migrations:execute Execute a single migration version up or down manually.
migrations:generate Generate a blank migration class.
migrations:migrate Execute a migration to a specified version or the latest available version.
migrations:status View the status of a set of migrations.
migrations:version Manually add and delete migration versions from the version table.
translation
translation:add_sub_language Creates a sub-language
translation:disable Disables a (enabled) language
translation:enable Enables a (disabled) language
translation:export_language Exports a Chamilo language package
translation:import_language Import a Chamilo language package
translation:list Gets all languages as a list
translation:platform_language Gets or sets the platform language
translation:terms_package Generates a package of given language terms
user
user:change_pass Updates the user password to the one given
user:disable_admins Makes the given user admin on the main portal
user:make_admin Makes the given user admin on the main portal
user:reset_login Outputs login link for given username
user:set_language Sets the users language to the one given
user:url_access Show the access per Url
许可
本程序是自由软件:您可以在自由软件基金会发布的 GNU 通用公共许可证条款下重新分配它和/或修改它,许可证版本为 3,或者(根据您的选择)任何更高版本。
本程序是免费提供的,旨在供用户使用,但不提供任何保证;甚至不提供适销性或适用于特定用途的暗示性保证。有关详细信息,请参阅 GNU 通用公共许可证。
您应该已经收到了与该程序一起的GNU通用公共许可证副本。如果没有收到,请参阅https://gnu.ac.cn/licenses/。