<commit_before># Metatron – CLI tool for S9y

A command line tool (written in PHP) for developers and admins of [Serendipity](http://s9y.org).

## Installation

There are two ways to install Metatron.

### Install the metatron.phar file

Download the phar file to your Serendipity root directory:

`wget https://raw.github.com/s9y/Metatron/master/metatron.phar`

### Install Metatron from source using Composer

```bash
# Clone the git repository
git clone https://github.com/s9y/Metatron

# Download Composer
curl -s https://getcomposer.org/installer | php

# Use Composer to install all dependencies
php ./composer.phar install
```

### Requirements

Metatron has been tested on Linux and PHP 5.4.9, but should run in other environments and at least PHP 5.3.3.

## Usage

Right now, there are only a few commands. Change to your Serendipity root directory and make sure you have read permissions to `serendipity_config_local.inc.php`.

You get a list of all available commands by entering:

```bash
$ php metatron.phar list
```

If you need help running a command, type:

```bash
$ php metatron.phar help <command>
```

### Keeping Metatron up to date

As of version 0.1.1, Metatron is able to update itself to the latest version. Just run

```bash
$ php metatron.phar self-update
```

### Diagnostics

#### Serendipity version

Prints the current S9y version.

```bash
$ php metatron.phar diag:version
```

#### Information about the current installation

Prints basic information about the current S9y installation.

```bash
$ php metatron.phar diag:version
```

#### Retrieve config values

Prints the value of one or more config keys where the optional argument `name` is the name of the config key. Setting the `search` option list all config keys that contain `name`.

```bash
$ php metatron.phar diag:config [-s|--search] [name]
```

### User

#### List users

Lists all users in the system. You can enter an optional `username`.

```bash
$ php metatron.phar user:list [username]
```
#### Set new password for user

Set new password for user. Opens a dialog where you must enter the user's new password twice.

```bash
$ php metatron.phar user:password username
```

### Cache

#### Flush cache

Flushes cache directory. You can enter an optional cache directory (Default: templates_c).

```bash
$ php metatron.phar cache:flush [dir]
```

### Comments

#### List comments

Lists all comments, or the last X comments.

```bash
$ php metatron.phar comment:list [limit]
```

### Approve comments

List and approve comments, or approve a single comment by id. This will most certainly change in future versions.

```bash
$ php metatron.phar comment:approve [commentid]
```

## Contributing

If you want to contribute to Metatron, you're invited to fork the [repository](https://github.com/s9y/Metatron) and open a [Pull Request](https://help.github.com/articles/using-pull-requests).

If you find a bug in Metatron, please [file an issue](https://github.com/s9y/Metatron/issues). Metatron is currently in an alpha state and should **not** be used on production servers! You have been warned ;)
<commit_msg>Added better instructions for developers<commit_after># Metatron – CLI tool for S9y

A command line tool (written in PHP) for developers and admins of [Serendipity](http://s9y.org).

## Installation

There are two ways to install Metatron.

### Install the metatron.phar file

Download the phar file to your Serendipity root directory:

`wget https://raw.github.com/s9y/Metatron/master/metatron.phar`

### Install Metatron from source using Composer

```bash
# Clone the git repository
git clone https://github.com/s9y/Metatron

# Download Composer
curl -s https://getcomposer.org/installer | php

# Use Composer to install all dependencies
php ./composer.phar install
```

### Requirements

Metatron has been tested on Linux and PHP 5.4.9, but should run in other environments and at least PHP 5.3.3.

## Usage

Right now, there are only a few commands. Change to your Serendipity root directory and make sure you have read permissions to `serendipity_config_local.inc.php`.

You get a list of all available commands by entering:

```bash
$ php metatron.phar list
```

If you need help running a command, type:

```bash
$ php metatron.phar help <command>
```

### Keeping Metatron up to date

As of version 0.1.1, Metatron is able to update itself to the latest version. Just run

```bash
$ php metatron.phar self-update
```

### Diagnostics

#### Serendipity version

Prints the current S9y version.

```bash
$ php metatron.phar diag:version
```

#### Information about the current installation

Prints basic information about the current S9y installation.

```bash
$ php metatron.phar diag:version
```

#### Retrieve config values

Prints the value of one or more config keys where the optional argument `name` is the name of the config key. Setting the `search` option list all config keys that contain `name`.

```bash
$ php metatron.phar diag:config [-s|--search] [name]
```

### User

#### List users

Lists all users in the system. You can enter an optional `username`.

```bash
$ php metatron.phar user:list [username]
```
#### Set new password for user

Set new password for user. Opens a dialog where you must enter the user's new password twice.

```bash
$ php metatron.phar user:password username
```

### Cache

#### Flush cache

Flushes cache directory. You can enter an optional cache directory (Default: templates_c).

```bash
$ php metatron.phar cache:flush [dir]
```

### Comments

#### List comments

Lists all comments, or the last X comments.

```bash
$ php metatron.phar comment:list [limit]
```

### Approve comments

List and approve comments, or approve a single comment by id. This will most certainly change in future versions.

```bash
$ php metatron.phar comment:approve [commentid]
```

## Contributing

If you want to contribute to Metatron, you're invited to fork the [repository](https://github.com/s9y/Metatron) and open a [Pull Request](https://help.github.com/articles/using-pull-requests).

* Make sure you have [Composer](http://getcomposer.org/) and [Phing](http://www.phing.info/) installed
* Clone the repository into the Serendipity web root, e.g. `git clone https://github.com/s9y/Metatron.git`
* Next, `cd Metatron && composer install --dev` to install the dependencies
* You should always create a new version of the `metatron.phar` PHAR archive after you finished by simply calling `phing`
* To run commands from the Serendipity web root, either symlink the `metatron.phar` PHAR archive or call `php Metatron/console.php [options] command [arguments]` as root

If you find a bug in Metatron, please [file an issue](https://github.com/s9y/Metatron/issues). Metatron is currently in an alpha state and should **not** be used on production servers! You have been warned ;)

{'fraction_non_alphanumeric': 0.10398359695371998, 'fraction_numerical': 0.005125951962507323, 'mean_word_length': 4.356078431372549, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 13, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2572863', 'n_tokens_mistral': 2176, 'n_tokens_neox': 2042, 'n_words': 870}