Console tools

Contents...

Webasyst framework allows executing several service commands by means of command line interface (CLI). Such service commands are useful for developers of custom products: apps and plugins.

To execute CLI commands, you must have appropriate access level to your web server with installed Webasyst framework; e.g., console (terminal) or SSH. For executing a service command, PHP interpreter must be called with file name wa.php specified, which is located in framework's root directory.

php wa.php createApp app_id parameters

Creates a basic set of directories and files required for the development of a new app inside wa-apps/[app_id]/ directory.

Parameters

  • app_id

    App ID in lower case; e.g., myapp.

  • parameters

    Parameters:

    • -name: App name; if the name consists of several words, it must be enclosed in quotes; e.g., 'My app'.
    • -version: App versions; e.g., 1.0.0.
    • -vendor: Developer ID.
    • -frontend: Whether app has a frontend.
    • -themes: Whether app supports design themes (available only together with parameter -frontend).
    • -plugins: Whether app supports plugins.
    • -cli: Whether app provides CLI call handlers, mainly used for cron job setup.
    • -api: Whether app provides API methods.

Example

php wa.php createApp myapp -name 'My app' -version 1.0.0 -vendor 123456 -frontend -themes -plugins -cli -api

php wa.php createPlugin app_id plugin_id parameters

>Creates a basic set of directories and files required for the development of a new plugin for an existing app, inside directory wa-apps/[app_id]/plugins/[plugin_id].

Parameters

  • app_id

    App ID in lower case; e.g., myapp.

  • plugin_id

    Plugin ID in lower case; e.g., myplugin.

  • parameters

    Parameters:

    • -name: Plugin name; if the name consists of several words, it must be enclosed in quotes; e.g., 'My plugin'.
    • -version: Plugin version; e.g., 1.0.0.
    • -vendor: Developer ID.
    • -frontend: Whether plugin provides functionality available for frontend users.
    • -settings: Whether plugin implements custom settings interface screen (as replacement for standard settings screen).

Example

php wa.php createPlugin someapp myplugin -name 'My plugin' -version 1.0.0 -vendor 123456 -frontend -settings

php wa.php createSystemplugin type plugin_id parameters

Creates a basic set of directories and files required for the development of a new payment, shipping, or SMS system plugin inside directory wa-plugins/[type]/[plugin_id].

Parameters

  • type

    Plugin type: payment, shipping, or sms.

  • plugin_id

    Plugin ID in lower case; e.g., myplugin.

  • parameters

    Parameters:

    • -name: Plugin name; if the name consists of several words, it must be enclosed in quotes; e.g., 'My plugin'.
    • -version: Plugin version; e.g., 1.0.0.
    • -vendor: Developer ID.
    • -settings: Whether plugin provides a settings interface to user.
    • -prototype: ID of an installed system plugin of the same type whose source code must be used as a basis for the newly created plugin.

Example

php wa.php createSystemplugin shipping myplugin -name 'My shipping' -version 1.0.0 -vendor 123456 -prototype courier

php wa.php createTheme app_id[,app_id_2[,...]] theme_id parameters

Creates a basic set of directories and files required for the development of a new design theme.

Parameters

  • app_id[,app_id_2[,...]]

    ID of an app, or several apps separated by a comma. You may use * (asterisk) instead of listing individual app IDs with frontend support which are currently installed in the developer’s account.

  • theme_id

    Design theme ID in lower case; e.g., mytheme.

  • parameters

    Parameters:

    • -name: Design theme name; if the name consists of several words, it must be enclosed in quotes; e.g., 'My theme'.
    • -parent: Parent theme ID.
    • -version: Theme version ; e.g., 1.0.0.
    • -vendor: Developer ID.
    • -prototype: ID of the design theme which must be used as a prototype. If not specified, design theme default is used as a prototype.

Example

php wa.php createTheme site,shop,blog mytheme -name 'My theme' -version 1.0.0 -vendor 123456 -prototype dummy

php wa.php createWidget app_id widget_id parameters

Creates a basic set of directories and files required for the development of a new widget.

Parameters

  • app_id

    App ID. To create a system widget in directory wa-widgets/, specify webasyst as app ID.

  • widget_id

    Widget ID in lower case; e.g., mywidget.

  • parameters

    Parameters:

    • -name: Widget name; if the name consists of several words, it must be enclosed in quotes; e.g., 'My widget'.
    • -version: Widget version; e.g., 1.0.0.
    • -vendor: Developer ID.
    • -settings: Whether widget provides a settings interface to user.

Example

php wa.php createWidget shop mywidget -name 'My widget' -version 1.0.0 -vendor 123456 -settings

php wa.php generateDb app_id/plugin_id tables -update

Generates or updates database description file of an app or a plugin at lib/config/db.php.

Parameters

  • app_id

    App ID in lower case; e.g., myapp.

  • plugin_id

    Optional plugin ID, if file db.php must be generated for a plugin rather than an app.

  • tables

    Table names, separated by comma, whose descriptions must be added to the file.

  • -update

    Optional parameter allowing you to update the contents of existing database description file.

Examples for an app

#create file db.php
php wa.php generateDb myapp myapp_items myapp_types

#update file db.php
php wa.php generateDb myapp myapp_items myapp_types -update

Examples for a plugin

#create file db.php
php wa.php generateDb someapp/myplugin myplugin_items myplugin_types

#update file db.php
php wa.php generateDb someapp/myplugin myplugin_items myplugin_types -update

php wa.php compress slug params

Check source code style and formatting and compress source files to an archive for publication in Webasyst Store.

Parameters

  • slug

    ID of an app, plugin, or design theme. Correct examples of product IDs:

    • myapp
    • someapp/plugins/myplugin
    • someapp/themes/mytheme
    • wa-plugins/payment/myplugin
    • wa-plugins/shipping/myplugin
    • wa-plugins/sms/myplugin
  • params

    Parameters:

    • -style Code checking options:
      • true: All source code is checked.
      • false: Source code is not checked.
      • no-vendors: (default choice) Source code is checked except for file contained in directories lib/vendors/ and js/vendors/ (third party components used in your app or plugin).
    • -skip Options to skip certain operations:
      • compress: Do not compress files to an archive.
      • test: Do not check code style, availability of required frontend routing configuration and database descriptions.
      • all: Do not perform any of the above actions.
      • none: (default choice) Do not skip anything, i.e. perform all actions.

Examples

# check source code except for third-party components and compress files to archive
php wa.php compress someapp/plugins/myplugin

# check all source code including that of third parties and compress files to archive
php wa.php compress someapp/plugins/myplugin -style true

# check source code except for third-party components without compressing files to archive
php wa.php compress someapp/plugins/myplugin -skip compress

# compress files to archive without any checks
php wa.php compress someapp/plugins/myplugin -skip test

php wa.php locale slug --debug

Search for new localization strings, which adds keys used in the source code of a product to its localization files with the .po name extension if such keys are not available in those files. The search finds only the keys that are passed as strings directly into localization functions rather than variables.

Parameters

  • slug

    ID of an app, plugin, or design theme. Correct examples of product IDs:

    • myapp
    • someapp/plugins/myplugin
    • someapp/themes/mytheme
    • wa-plugins/payment/myplugin
    • wa-plugins/shipping/myplugin
    • wa-plugins/sms/myplugin
  • --debug

    Flag requiring to add also debugging information to PO files:

    • paths to files and their line numbers where particular localization keys are used,
    • “Not found” comments — in the case when localization keys available in a PO file are not used in the source code, excluding cases when keys are passed to localization functions as variables rather than strings.

Examples

# only add new localization keys to PO files
php wa.php locale someapp
php wa.php locale someapp/plugins/myplugin

# add new localization keys to PO files
# as well as comments with file paths or notices about non-found keys
php wa.php locale someapp --debug
php wa.php locale someapp/plugins/myplugin --debug