Skip to content

Commit

Permalink
Merge pull request #10 from EvoTM/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Braker committed Jun 7, 2019
2 parents 282c42f + abfa31b commit 2814283
Show file tree
Hide file tree
Showing 72 changed files with 1,516 additions and 756 deletions.
22 changes: 13 additions & 9 deletions README.md
Expand Up @@ -15,18 +15,22 @@ A server controller for Trackmania² based on PHP 7.2 with Maniaplanet 4.1 suppo
* PHP 7.2+
* MySQL or MariaDB Server

### Installation (git)
### Installation (From GitHub)
###### Requirements
* Composer
###### Installation
1. Clone project `git clone https://github.com/EvoTM/EvoSC.git`
2. Go into the directory and run `composer install`
3. Copy contents from `config/default` to `config` and fill out the required fields
4. Run `php esc migrate` to create the database tables.
5. Run EvoSC
###### Clean installation
1. Clone project `git clone https://github.com/EvoTM/EvoSC.git`.
2. Switch to the new directory.
3. (Checkout develop branch `git checkout develop` to get the latest version).
4. Install required packages with `composer install`.
5. Run the controller `php esc run` it will exit with "Cannot open socket" because the configs are empty (This step is nessecay to copy all required config files to the /config directory).
6. Run `php esc migrate` to create the database tables.
7. Run EvoSC with `php esc run`.

| ⚠ If the cache and log folder aren't created automatically, you need to create them and restart the controller. |
| ⚠ If the cache and log folder are not created automatically, you need to create them and restart the controller. |
| --- |
###### Updating a github installation
1. Go to the EvoSC directory you want to update and run `git pull`.

### Music server installation
Download the [music-server](https://github.com/EvoTM/EvoSC/raw/master/core/Modules/music-client/music-server.zip) and extract it to your webserver with the ogg-files. Copy the `music.config.json` from the music-client-module directory to your config directory and set `url` to the URL of your webserver.
Expand All @@ -39,7 +43,7 @@ Get all available commands `php esc list`

| Action | Description |
| --------- | -------------------------------------------- |
| Run EvoSC | In terminal type `php esc run (-v\|-vv\|-vvv)` |
| Run EvoSC | In terminal type `php esc run (-v|-vv|-vvv)` |
| Import data from UASECO | In terminal type `php esc import:uaseco {host} {database} {user} {password}` optionally add `{table_prefix}` |
| Fix player scores and ranking | Run `php esc fix:scores` to re-calculate all scores and fix the player ranks. |
| Creating a database migration | Run `php esc make:migration <MigrationClassName>`. The migration is saved to to /Migrations. Copy it to your module if necessary. |
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -7,6 +7,7 @@
"latte/latte" : "^2.4",
"illuminate/pagination" : "^5.6",
"symfony/process" : "^4.2",
"symfony/event-dispatcher" : "^4.2"
"symfony/event-dispatcher" : "^4.2",
"composer/ca-bundle": "^1.1"
}
}
60 changes: 58 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

192 changes: 0 additions & 192 deletions core/Classes/Config.php

This file was deleted.

36 changes: 36 additions & 0 deletions core/Classes/File.php
Expand Up @@ -96,6 +96,10 @@ public static function createDirectory(string $name)
*/
public static function getDirectoryContents(string $path, string $filterPattern = null): Collection
{
if (!is_dir($path)) {
return collect();
}

if ($filterPattern) {
return collect(scandir($path))->filter(function ($file) use ($filterPattern) {
return preg_match($filterPattern, $file);
Expand All @@ -117,6 +121,10 @@ public static function getFilesRecursively(string $baseDirectory, string $filter
{
$files = collect();

if (!is_dir($baseDirectory)) {
return $files;
}

File::getDirectoryContents($baseDirectory)
->each(function ($file) use ($baseDirectory, $filterPattern, &$files) {
$path = $baseDirectory . DIRECTORY_SEPARATOR . $file;
Expand All @@ -136,6 +144,26 @@ public static function getFilesRecursively(string $baseDirectory, string $filter
return $files;
}

public static function getFiles(string $baseDirectory, string $filterPattern)
{
$files = collect();

File::getDirectoryContents($baseDirectory)
->each(function ($file) use ($baseDirectory, $filterPattern, &$files) {
$path = $baseDirectory . DIRECTORY_SEPARATOR . $file;

if (!is_dir($path)) {
//File is not directory
if (preg_match($filterPattern, $file)) {
//Add template
$files->push($path);
}
}
});

return $files;
}

/**
* Delete a file.
*
Expand Down Expand Up @@ -199,4 +227,12 @@ public static function rename(string $sourceFile, string $targetFile)

rename($sourceFile, $targetFile);
}

public static function copy(string $source, string $target)
{
$source = str_replace('/', DIRECTORY_SEPARATOR, $source);
$target = str_replace('/', DIRECTORY_SEPARATOR, $target);

copy($source, $target);
}
}
8 changes: 7 additions & 1 deletion core/Classes/Log.php
Expand Up @@ -61,7 +61,13 @@ public static function logAddLine(string $prefix, string $string, $echo = true)
}

list($childClass, $caller) = debug_backtrace(false, 2);
$callingClass = $caller['class'] . $caller['type'] . $caller['function'];

if (isset($caller['class']) && isset($caller['type'])) {
$callingClass = $caller['class'] . $caller['type'] . $caller['function'];
}else{
$callingClass = $caller['function'];
}


if (isVerbose()) {
$callingClass .= '(';
Expand Down

0 comments on commit 2814283

Please sign in to comment.