diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..723ef36
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..32b2ef3
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,12 @@
+
+# BEGIN WordPress
+
+RewriteEngine On
+RewriteBase /wp-quick-install/
+RewriteRule ^index\.php$ - [L]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule . /wp-quick-install/index.php [L]
+
+
+# END WordPress
\ No newline at end of file
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index b7aaee1..6e567fe
--- a/README.md
+++ b/README.md
@@ -1,132 +1,47 @@
-WP Quick Install 1.4.2
-================
+# Instalace skautské Wordpress šablony DSW v Lebedě na jeden klik
-WP Quick Install is the easiest way to install WordPress.
+## Status: v1.0
-A lightweight script which automatically downloads and install WordPress, plugins and themes you want.
+## Manuál na instalaci
-Simply download the .zip archive et go to *wp-quick-install/index.php*
+Jak zpřístupnit na Lebedě autoinstalaci Wordpressu:
-Changelog
-================
+* Jako základ používáme https://github.com/GeekPress/WP-Quick-Install (fork)
+* **Nastavení** je v souboru `data.ini` (včetně instalovaných pluginů a všeho dalšího)
+* Zrušili jsme GUI a JS z původního skriptu a všechno nasypali do `WordpressService.php`
+* **Requirement** je v composer.json, stačí spustit `composer install`
+* Chtěné **DSW téma** se získá pomocí automatického stánutí z DWS githubu. Alternativně je možnost umístit soubor vedle skriptu a pojmenovat ho `theme.zip`
+* Potřebné parametry pro instalaci jsou jako paramtery metody, return zatím nemáme žádný (vzhledem k tomu, že se skript bude provádět jindy (cronem) než ho uživatel zadává)
+* Potřebné **parametry** pro service: $dbName, $dbUserName, $dbPassword, $dbHost, $websiteTitle, $userLogin, $adminPassword, $adminEmail
+* Pozor, skript běží dlouho (přeci jen stahuje, dekomprimuje a instaluje zaráz), takže je potřeba hlídat timeout chyb (na průměrném NB to běželo skoro minutu)
-1.4.2
------------
-* Delete Tweentyfifteen & Tweentysixteen themes
+#### stahování češtiny napřímo
+https://cs.wordpress.org/latest-cs_CZ.zip
-1.4.1
------------
-* Fix quote issue with WordPress.com API Key
+## TODO shortterm
-1.4
------------
-* Fix database issue since WordPress 4.1
-* You can add your WordPress.com API Key
+#### automaticky přidat obrázky z theme
-1.3.3
------------
+spočívá v poslání issue do DSW, aby byly obrázky includované dynamicky (teď si neporadí s subfolder v adresářové cestě) - https://github.com/skaut/dsw-oddil/issues/129
-* Add SSL compatibility
-* Remove SSL function (cause trouble with process installation)
+#### automaticky přidat menu z theme
-1.3.2
------------
+řešíme s Kalichem
-* Add a script header
-* Security improvement
-1.3.1
------------
+## TODO longterm
-* Fix error for PHP > 5.5: Strict standards: Only variables should be passed by reference in ../wp-quick-install/index.php on line 10
+#### Volitelný plugin pro bazar
-1.3
------------
+na vyžádání includenout plugin pro bazar (https://wordpress.org/plugins/skaut-bazar/)
-* Possiblity to select WordPress language installation
-* Permaling management
+#### Umožnit instalaci i přes existující web
+@kalich5 - nevhodné dělat automaticky, protože se tím naseká moc problémů - lepší kontrolovat, zda je složka prázdná a pokud ne, rovnou to nepovolit (jak to dělá např. `git clone` nebo velcí hostingové)
-1.2.8.1
------------
+Inspired by literat v issue:
-* You can now declare articles to be generated via data.ini file
-* Fix bug on new articles
-* You can now select the revision by articles
-
-1.2.8
------------
-
-* Media management
-
-1.2.7.2
------------
-
-* Security : Forbiden access to data.ini from the browser
-
-1.2.7.1
------------
-
-* noindex nofollow tag.
-
-1.2.7
------------
-
-* Premium extension by adding archives in plugins folder
-* You can enable extension after installation
-* Auto supression of Hello Dolly extension
-* You can add a theme and enable it
-* You can delete Twenty Elever and Twenty Ten
-
-1.2.6
------------
-
-* Fix a JS bug with data.ini
-
-1.2.5
------------
-
-* You can delete the default content added by WordPress
-* You can add new pages with data.ini
-* Data.ini update
-
-1.2.4
------------
-
-* Two new debug options : *Display errors* (WP_DEBUG_DISPLAY) and *Write errors in a log file* (WP_DEBUG_LOG)
-
-1.2.3
------------
-
-* SEO Fix bug
-* Automatic deletion of licence.txt and readme.html
-
-1.2.2
------------
-
-* Deletion of all exec() fucntions
-* Unzip WordPress and plugins with ZipArchive class
-* Using scandir() and rename() to move WordPress files
-
-1.2.1
------------
-
-* Checking chmod on parent folder
-* Adding a link to website and admin if success
-
-1.2
------------
-
-* You can now pre-configure the form with data.ini
-
-
-1.1
------------
-
-* Code Optimisation
-
-
-1.0
------------
-
-* Initial Commit
+* na začátku se automatika pouze zeptá na login a heslo pro administrátorský účet
+* musí proběhnout kontrola FTP a databáze, tj. pokud je zde nějaký obsah, bude smazán a uživatel na to musí být upozorněn a potvrdit to
+* veškerý obsah před instalací bude z FTP i DB smazán
+* jako základní šablona společně s Wordpressem bude instalována DSW Oddíl
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..69d2387
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,12 @@
+{
+ "name": "skaut/wp-instalator-lebeda",
+ "type": "library",
+ "description": "Word press instalation package",
+ "keywords": ["skaut"],
+ "homepage": "https://github.com/skaut/WordPress-Lebeda-instalator",
+ "require": {
+ "php": ">=7.0",
+ "guzzlehttp/guzzle": "^6.2"
+ },
+ "minimum-stability": "stable"
+}
diff --git a/wp-quick-install/.htaccess b/wp-quick-install/.htaccess
old mode 100644
new mode 100755
diff --git a/wp-quick-install/WordpressService.php b/wp-quick-install/WordpressService.php
new file mode 100644
index 0000000..1dd314d
--- /dev/null
+++ b/wp-quick-install/WordpressService.php
@@ -0,0 +1,107 @@
+randomString(6) . '_';
+ $data['default_content'] = $data['db']['default_content'];
+ $data['language'] = 'en_US';
+ $data['directory'] = '';
+ $data['admin']['user_login'] = $userLogin;
+ $data['user_login'] = $data['admin']['user_login'];
+ $data['admin']['password'] = $adminPassword;
+ $data['admin']['email'] = $adminEmail;
+ $data['weblog_title'] = $websiteTitle;
+ $data['admin_password'] = $adminPassword;
+ $data['admin_email'] = $adminEmail;
+ $data['blog_public'] = 1;
+ $data['activate_theme'] = 1;
+ $data['plugins'] = 'tiled-gallery-carousel-without-jetpack;wordfence;wp-super-cache;google-calendar-events;easy-facebook-feed';
+ $data['activate_plugins'] = 1;
+ $data['permalink_structure'] = '/%postname%/';
+ $data['thumbnail_size_w'] = 0;
+ $data['thumbnail_size_h'] = 0;
+ $data['thumbnail_crop'] = 1;
+ $data['medium_size_w'] = 0;
+ $data['medium_size_h'] = 0;
+ $data['large_size_w'] = 0;
+ $data['large_size_h'] = 0;
+ $data['upload_dir'] = '';
+ $data['uploads_use_yearmonth_folders'] = 1;
+ $data['post_revisions'] = 0;
+ $data['disallow_file_edit'] = 1;
+ $data['autosave_interval'] = 7200;
+ $data['wpcom_api_key'] = '';
+
+ $installAddress = 'http://localhost/wp-quick-install';
+
+ $client = new \GuzzleHttp\Client([
+ // Base URI is used with relative requests
+ 'base_uri' => $installAddress,
+ // You can set any number of default request options.
+ 'timeout' => 120.0,
+ ]);
+
+ $postData = [
+ 'form_params' => $data
+ ];
+ $response = $client->request('POST', $installAddress . '/wp-quick-install/index.php?action=check_before_upload', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST', $installAddress . '/wp-quick-install/index.php?action=download_wp', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php?action=unzip_wp', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php?action=wp_config', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php/wp-admin/install.php?action=install_wp', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php/wp-admin/install.php?action=install_theme', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php/wp-quick-install/index.php?action=install_plugins', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ $response = $client->request('POST',$installAddress . '/wp-quick-install/index.php/wp-quick-install/index.php?action=success', $postData);
+ if ($response->getStatusCode() >= 300) {
+ echo $response->getBody()->getContents();
+ }
+ }
+}
diff --git a/wp-quick-install/assets/css/buttons.min.css b/wp-quick-install/assets/css/buttons.min.css
old mode 100644
new mode 100755
diff --git a/wp-quick-install/assets/css/style.min.css b/wp-quick-install/assets/css/style.min.css
old mode 100644
new mode 100755
diff --git a/wp-quick-install/assets/images/wordpress-logo.svg b/wp-quick-install/assets/images/wordpress-logo.svg
old mode 100644
new mode 100755
diff --git a/wp-quick-install/assets/js/jquery-1.8.3.min.js b/wp-quick-install/assets/js/jquery-1.8.3.min.js
old mode 100644
new mode 100755
diff --git a/wp-quick-install/assets/js/script.js b/wp-quick-install/assets/js/script.js
old mode 100644
new mode 100755
index c29e7d3..c38e493
--- a/wp-quick-install/assets/js/script.js
+++ b/wp-quick-install/assets/js/script.js
@@ -1,10 +1,12 @@
+var $debug, $debug_options, $debug_display, $debug_log, $response;
+
$(document).ready(function() {
// Debug mode
- var $debug = $('#debug'),
- $debug_options = $('#debug_options'),
- $debug_display = $debug_options.find('#debug_display');
- $debug_log = $debug_options.find('#debug_log');
+ $debug = $('#debug');
+ $debug_options = $('#debug_options');
+ $debug_display = $debug_options.find('#debug_display');
+ $debug_log = $debug_options.find('#debug_log');
$debug.change(function() {
if ( $debug.is(':checked') ) {
@@ -221,7 +223,7 @@ $(document).ready(function() {
}
- var $response = $('#response');
+ $response = $('#response');
$('#submit').click( function() {
@@ -289,62 +291,79 @@ $(document).ready(function() {
return false;
});
- // Let's unzip WordPress
- function unzip_wp() {
- $response.html("