diff --git a/.gitignore b/.gitignore index 3fbe594c7..3dbf758f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,21 @@ sources/* !sources/README.md logs/* !logs/README.md -remote-wiki-config.sh \ No newline at end of file +config/local/* +!config/local/README.md + +# data directory used to hold MySQL and Elasticsearch data +# which should not be added to this repo. However, there are +# some README files as placeholders in this directory which +# have been explicitly added to the repo. +data/* + + +# ignore wiki blender landing page +htdocs/WikiBlender + +htdocs/mediawiki +htdocs/wikis/* + +simplesamlphp/ + diff --git a/README.md b/README.md index 431a18d52..a2d8ee576 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# meza v0.4 +# meza v0.9 meza configures a CentOS/RedHat server with a complete enterprise MediaWiki installation. @@ -37,6 +37,9 @@ While the goal is to have an entirely scripted install of CentOS and the entire ## See Also * [Creating and importing wikis](manual/AddingWikis.md) +* [Accessing Elasticsearch plugins](manual/ElasticsearchPlugins.md) +* [Installing additional extensions](manual/installing-additional-extensions.md) +* [Directory structure overview](manual/DirectoryStructure.md) ## Contributing If you'd like to contribute to this project, please see [this guide on how to help](CONTRIBUTING.md). diff --git a/config/core/BlenderSettings.php b/config/core/BlenderSettings.php new file mode 100644 index 000000000..a366dc9a3 --- /dev/null +++ b/config/core/BlenderSettings.php @@ -0,0 +1,20 @@ + $primeWikiId, + 'database' => $primeWikiDBname, + ); + } ); + + $wgSharedDB = $primewiki[ 'database' ]; + $wgSharedTables = array( + 'user', // default + 'user_properties', // default + 'interwiki', // additional + ); + +} @@ -293,8 +322,12 @@ $wgParserCacheType = CACHE_NONE; // optional; if set to CACHE_MEMCACHED, templates used to format query results in generic footer don't work $wgMessageCacheType = CACHE_MEMCACHED; // optional $wgMemCachedServers = array( "127.0.0.1:11211" ); -$wgSessionsInObjectCache = true; // optional -$wgSessionCacheType = CACHE_MEMCACHED; // optional + +// memcached is setup and will work for sessions with meza, unless you use +// SimpleSamlPhp. For that reason memcached is disabled for sessions. This will +// be fixed in a later version. +$wgSessionsInObjectCache = false; // optional +$wgSessionCacheType = CACHE_NONE; // optional ## To enable image uploads, make sure the 'images' directory @@ -452,6 +485,91 @@ +/** + * 7) PERMISSIONS + * + * + * + **/ +if ( ! isset( $mezaAuthType ) ) { + $mezaAuthType = 'anon-edit'; // default: wide open! +} +if ( $mezaAuthType === 'anon-edit' ) { + + // allow anonymous read + $wgGroupPermissions['*']['read'] = true; + $wgGroupPermissions['user']['read'] = true; + + // allow anonymous write + $wgGroupPermissions['*']['edit'] = true; + $wgGroupPermissions['user']['edit'] = true; + +} + +else if ( $mezaAuthType === 'anon-read' ) { + + // allow anonymous read + $wgGroupPermissions['*']['read'] = true; + $wgGroupPermissions['user']['read'] = true; + + // do not allow anonymous write (must be registered user) + $wgGroupPermissions['*']['edit'] = false; + $wgGroupPermissions['user']['edit'] = true; + +} + +else if ( $mezaAuthType === 'user-edit' ) { + + // no anonymous + $wgGroupPermissions['*']['read'] = false; + $wgGroupPermissions['*']['edit'] = false; + + // users read and write + $wgGroupPermissions['user']['read'] = true; + $wgGroupPermissions['user']['edit'] = true; + +} + +else if ( $mezaAuthType === 'user-read' ) { + + // no anonymous + $wgGroupPermissions['*']['read'] = false; + $wgGroupPermissions['*']['edit'] = false; + + // users read NOT write + $wgGroupPermissions['user']['read'] = true; + $wgGroupPermissions['user']['edit'] = false; + + $wgGroupPermissions['Contributor'] = $wgGroupPermissions['user']; + $wgGroupPermissions['Contributor']['edit'] = true; + +} + +else if ( $mezaAuthType === 'viewer-read' ) { + + // no anonymous or ordinary users + $wgGroupPermissions['*']['read'] = false; + $wgGroupPermissions['*']['edit'] = false; + $wgGroupPermissions['user']['read'] = false; + $wgGroupPermissions['user']['edit'] = false; + + // create the Viewer group with read permissions + $wgGroupPermissions['Viewer'] = $wgGroupPermissions['user']; + $wgGroupPermissions['Viewer']['read'] = true; + + // also explicitly give sysop read since you otherwise end up with + // a chicken/egg situation prior to giving people Viewer + $wgGroupPermissions['sysop']['read'] = true; + + // Create a contributors group that can edit + $wgGroupPermissions['Contributor'] = $wgGroupPermissions['user']; + $wgGroupPermissions['Contributor']['edit'] = true; + +} + + + + @@ -459,7 +577,7 @@ /** - * 7) EXTENSION SETTINGS + * 8) EXTENSION SETTINGS * * Code to load the extension "ExtensionLoader", which then installs and loads * other extensions as defined in "ExtensionSettings.php". Note that the file @@ -470,7 +588,7 @@ # # Enable Semantic MediaWiki semantics # -enableSemantics( $wikiId . '.' . $_SERVER[ 'SERVER_NAME' ] ); +enableSemantics( $wikiId ); # @@ -626,7 +744,7 @@ require_once $egExtensionLoader->registerLegacyExtension( "SemanticForms", "https://gerrit.wikimedia.org/r/mediawiki/extensions/SemanticForms.git", - "REL1_25" + "tags/3.5" ); @@ -816,16 +934,6 @@ $wgGroupPermissions['sysop']['interwiki'] = true; -# -# Extension:IMSQuery -# -require_once $egExtensionLoader->registerLegacyExtension( - "IMSQuery", - "https://github.com/jamesmontalvo3/IMSQuery.git", - "master" -); - - # # Extension:MasonryMainPage # @@ -869,16 +977,6 @@ ); -# -# Extension:SummaryTimeline -# -require_once $egExtensionLoader->registerLegacyExtension( - "SummaryTimeline", - "https://github.com/darenwelsh/SummaryTimeline.git", - "tags/0.1.3" -); - - # # Extension:YouTube # @@ -935,15 +1033,15 @@ # # Extension:PdfHandler # -require_once $egExtensionLoader->registerLegacyExtension( - "PdfHandler", - "https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler", - "REL1_25" -); +// require_once $egExtensionLoader->registerLegacyExtension( +// "PdfHandler", +// "https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler", +// "REL1_25" +// ); // Location of PdfHandler dependencies -$wgPdfProcessor = '/usr/bin/gs'; // installed via yum -$wgPdfPostProcessor = '/usr/local/bin/convert'; // built from source -$wgPdfInfo = '/usr/local/bin/pdfinfo'; // pre-built binaries installed +// $wgPdfProcessor = '/usr/bin/gs'; // installed via yum +// $wgPdfPostProcessor = '/usr/local/bin/convert'; // built from source +// $wgPdfInfo = '/usr/local/bin/pdfinfo'; // pre-built binaries installed # @@ -970,6 +1068,7 @@ if ( isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_SERVER['SERVER_ADDR'] ) && $_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR'] ) { + $wgServer = preg_replace( '/^http:\/\/([a-zA-Z\d-\.]+):9000/', 'https://$1', $wgServer ); $wgGroupPermissions['*']['read'] = true; $wgGroupPermissions['*']['edit'] = true; } @@ -985,7 +1084,6 @@ // URL to the Parsoid instance // MUST NOT end in a slash due to Parsoid bug -// Use port 8142 if you use the Debian package $wgVisualEditorParsoidURL = 'http://127.0.0.1:8000'; // Interwiki prefix to pass to the Parsoid instance @@ -995,7 +1093,7 @@ // Define which namespaces will use VE $wgVisualEditorNamespaces = array_merge( $wgContentNamespaces, - array( NS_USER, + array( NS_USER, NS_HELP, NS_PROJECT ) @@ -1020,7 +1118,6 @@ "REL1_25" ); $wgSearchType = 'CirrusSearch'; -include "$m_htdocs/wikis/$wikiId/config/disableSearchUpdate.php"; //$wgCirrusSearchServers = array( 'search01', 'search02' ); @@ -1060,58 +1157,110 @@ $wgApiFrameOptions = 'SAMEORIGIN'; // Use UploadWizard by default in navigation bar -$wgUploadNavigationUrl = "$wgScriptPath/index.php/Special:UploadWizard"; //Update with #156 +$wgUploadNavigationUrl = "$wgScriptPath/index.php/Special:UploadWizard"; $wgUploadWizardConfig = array( 'debug' => false, 'autoCategory' => 'Uploaded with UploadWizard', - 'feedbackPage' => 'FeedbackTest2', + 'feedbackPage' => 'Project:UploadWizard/Feedback', 'altUploadForm' => 'Special:Upload', 'fallbackToAltUploadForm' => false, 'enableFormData' => true, # Should FileAPI uploads be used on supported browsers? 'enableMultipleFiles' => true, 'enableMultiFileSelect' => true, 'tutorial' => array('skip' => true), - 'fileExtensions' => $wgFileExtensions //omitting this can cause errors + 'fileExtensions' => $wgFileExtensions, //omitting this can cause errors + 'licensing' => array( + // alternatively, use "thirdparty". Set in postLocalSettings.php like: + // $wgUploadWizardConfig['licensing']['defaultType'] = 'thirdparty'; + 'defaultType' => 'ownwork', + + 'ownWork' => array( + 'type' => 'or', + // Use [[Project:General disclaimer]] instead of default [[Template:Generic]] + 'template' => 'Project:General disclaimer', + 'defaults' => array( 'generic' ), + 'licenses' => array( 'generic' ) + ), + + 'thirdParty' => array( + 'type' => 'or', + 'defaults' => array( 'generic' ), + 'licenseGroups' => array( + array( + 'head' => 'mwe-upwiz-license-generic-head', + 'template' => 'Project:General disclaimer', // again, use General disclaimer + 'licenses' => array( 'generic' ), + ), + ) + ), + ), ); # -# Extension:Flow +# Extension:CollapsibleVector # require_once $egExtensionLoader->registerLegacyExtension( - 'Flow', - 'https://gerrit.wikimedia.org/r/mediawiki/extensions/Flow.git', + 'CollapsibleVector', + 'https://gerrit.wikimedia.org/r/mediawiki/extensions/CollapsibleVector', 'REL1_25' ); -// only allow sysops to create new flow boards -$wgGroupPermissions['sysop']['flow-create-board'] = true; -// store posts as html using Parsoid -$wgFlowContentFormat = 'html'; +# +# Extension:Math +# +require_once $egExtensionLoader->registerLegacyExtension( + 'Math', + 'https://gerrit.wikimedia.org/r/mediawiki/extensions/Math.git', + 'REL1_25' +); -// use VE -$wgFlowEditorList = array( 'visualeditor', 'none' ); +$wgMathValidModes[] = MW_MATH_MATHJAX; // Define MathJax as one of the valid math rendering modes +$wgUseMathJax = true; // Enable MathJax as a math rendering option for users to pick +$wgDefaultUserOptions['math'] = MW_MATH_MATHJAX; // Set MathJax as the default rendering option for all users (optional) +$wgMathDisableTexFilter = true; // or compile "texvccheck" +$wgDefaultUserOptions['mathJax'] = true; // Enable the MathJax checkbox option + + +# +# Extension:Flow +# +# Note: Flow removed due to being unable to search discussions. While the +# improved interface is great, it's useless if we can't search our old content. +# See issues #272. +# +// require_once $egExtensionLoader->registerLegacyExtension( +// 'Flow', +// 'https://gerrit.wikimedia.org/r/mediawiki/extensions/Flow.git', +// 'REL1_25' +// ); -// Define which namespaces will use Flow -$wgNamespaceContentModels[NS_PROJECT_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_USER_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_HELP_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_FILE_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_CATEGORY_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_MEDIAWIKI_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[NS_TEMPLATE_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[SMW_NS_FORM_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[SMW_NS_PROPERTY_TALK] = CONTENT_MODEL_FLOW_BOARD; -$wgNamespaceContentModels[SMW_NS_CONCEPT_TALK] = CONTENT_MODEL_FLOW_BOARD; +// // only allow sysops to create new flow boards +// $wgGroupPermissions['sysop']['flow-create-board'] = true; -// Connect Flow to Parsoid -$wgFlowParsoidURL = 'http://127.0.0.1:8000'; -$wgFlowParsoidPrefix = $wikiId; +// // store posts as html using Parsoid +// $wgFlowContentFormat = 'html'; +// // use VE +// $wgFlowEditorList = array( 'visualeditor', 'none' ); +// // Define which namespaces will use Flow +// $wgNamespaceContentModels[NS_PROJECT_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_USER_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_HELP_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_FILE_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_CATEGORY_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_MEDIAWIKI_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[NS_TEMPLATE_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[SMW_NS_FORM_TALK] = CONTENT_MODEL_FLOW_BOARD; // MW throws error: SMW_NS_FORM_TALK not a constant +// $wgNamespaceContentModels[SMW_NS_PROPERTY_TALK] = CONTENT_MODEL_FLOW_BOARD; +// $wgNamespaceContentModels[SMW_NS_CONCEPT_TALK] = CONTENT_MODEL_FLOW_BOARD; +// // Connect Flow to Parsoid +// $wgFlowParsoidURL = 'http://127.0.0.1:8000'; +// $wgFlowParsoidPrefix = $wikiId; @@ -1119,28 +1268,15 @@ /** - * 8) LOAD OVERRIDES + * 9) LOAD OVERRIDES * * * * **/ -if ( file_exists( "$m_htdocs/wikis/$wikiId/config/overrides.php" ) ) { - require_once "$m_htdocs/wikis/$wikiId/config/overrides.php"; +if ( file_exists( "$m_config/local/postLocalSettings_allWikis.php" ) ) { + require_once "$m_config/local/postLocalSettings_allWikis.php"; +} +if ( file_exists( "$m_htdocs/wikis/$wikiId/config/postLocalSettings.php" ) ) { + require_once "$m_htdocs/wikis/$wikiId/config/postLocalSettings.php"; } - - - - - - - - - -/** - * 9) HOMELESS ITEMS - * - * EVERYTHING BELOW HERE SHOULD BE MOVED INTO THE APPROPRIATE PLACE IN THIS - * DOCUMENT OR SUPPORTING SETTINGS DOCUMENTS. - **/ - diff --git a/scripts/config.sh b/config/core/config.sh similarity index 82% rename from scripts/config.sh rename to config/core/config.sh index daf7981d3..e0950a52f 100644 --- a/scripts/config.sh +++ b/config/core/config.sh @@ -4,9 +4,12 @@ m_install=/opt # was :m_install=/root/mezadownloads m_meza="$m_install/meza" # was: m_meza="$m_install/meza1" +# config dir +m_config="$m_meza/config" + # webserver variables m_htdocs="$m_meza/htdocs" # was: m_htdocs="$m_www_meza/htdocs" m_mediawiki="$m_htdocs/mediawiki" # app locations -m_apache="/usr/local/apache2" \ No newline at end of file +m_apache="/etc/httpd" \ No newline at end of file diff --git a/scripts/elasticsearch.repo b/config/core/elasticsearch.repo similarity index 100% rename from scripts/elasticsearch.repo rename to config/core/elasticsearch.repo diff --git a/scripts/elasticsearch.yml b/config/core/elasticsearch.yml similarity index 98% rename from scripts/elasticsearch.yml rename to config/core/elasticsearch.yml index 5113e3c6e..180522d12 100644 --- a/scripts/elasticsearch.yml +++ b/config/core/elasticsearch.yml @@ -146,7 +146,7 @@ path.conf: /etc/elasticsearch # Path to directory where to store index data allocated for this node. # -path.data: /var/data/elasticsearch +path.data: /opt/meza/data/elasticsearch/data # # Can optionally include more than one location, causing data to be striped across # the locations (a la RAID 0) on a file level, favouring locations with most free @@ -156,7 +156,7 @@ path.data: /var/data/elasticsearch # Path to temporary files: # -path.work: /var/work/elasticsearch +path.work: /opt/meza/data/elasticsearch/work # Path to log files: # @@ -164,7 +164,7 @@ path.logs: /var/log/elasticsearch # Path to where plugins are installed: # -#path.plugins: /path/to/plugins +path.plugins: /opt/meza/data/elasticsearch/plugins #################################### Plugin ################################### @@ -298,7 +298,7 @@ path.logs: /var/log/elasticsearch # and master node is elected. Multicast discovery is the default. # Set to ensure a node sees N other master eligible nodes to be considered -# operational within the cluster. This should be set to a quorum/majority of +# operational within the cluster. This should be set to a quorum/majority of # the master-eligible nodes in the cluster. # #discovery.zen.minimum_master_nodes: 1 @@ -385,4 +385,4 @@ path.logs: /var/log/elasticsearch #http.jsonp.enable: true # Enable dynamic scripting per https://www.mediawiki.org/wiki/Thread:Extension_talk:CirrusSearch/error_using_ElasticSearch -script.disable_dynamic: false \ No newline at end of file +script.disable_dynamic: false diff --git a/config/core/httpd.conf b/config/core/httpd.conf new file mode 100644 index 000000000..5fbf538d3 --- /dev/null +++ b/config/core/httpd.conf @@ -0,0 +1,503 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so "logs/access_log" +# with ServerRoot set to "/usr/local/apache2" will be interpreted by the +# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" +# will be interpreted as '/logs/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot "/etc/httpd" + +# +# Mutex: Allows you to set the mutex mechanism and mutex file directory +# for individual mutexes, or change the global defaults +# +# Uncomment and change the directory if mutexes are file-based and the default +# mutex file directory is not on a local disk or is not appropriate for some +# other reason. +# +# Mutex default:logs + + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +Include conf.modules.d/*.conf +LoadModule php5_module modules/libphp5.so + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User apache +Group apache + + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +#ServerName www.example.com:80 + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride none + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +# DocumentRoot "/opt/meza/htdocs" +# +# # +# # Possible values for the Options directive are "None", "All", +# # or any combination of: +# # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews +# # +# # Note that "MultiViews" must be named *explicitly* --- "Options All" +# # doesn't give it to you. +# # +# # The Options directive is both complicated and important. Please see +# # http://httpd.apache.org/docs/2.4/mod/core.html#options +# # for more information. +# # +# Options Indexes FollowSymLinks + +# # +# # AllowOverride controls what directives may be placed in .htaccess files. +# # It can be "All", "None", or any combination of the keywords: +# # AllowOverride FileInfo AuthConfig Limit +# # +# AllowOverride all + +# # +# # Controls who can get stuff from this server. +# # +# Require all granted + +# # +# # Disable directory browsing +# # +# Options All -Indexes + +# + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.php index.html + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "logs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + CustomLog "logs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + #CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + # ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock cgisock + + +# +# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# +# +# AllowOverride None +# Options None +# Require all granted +# + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig /etc/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +# +# Specify a default charset for all content served; this enables +# interpretation of all content as UTF-8 by default. To use the +# default browser choice (ISO-8859-1), or to allow the META tags +# in HTML content to override this choice, comment out this +# directive: +# +AddDefaultCharset UTF-8 + + + # + # The mod_mime_magic module allows the server to use various hints from the + # contents of the file itself to determine its type. The MIMEMagicFile + # directive tells the module where the hint definitions are located. + # + MIMEMagicFile conf/magic + + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults: EnableMMAP On, EnableSendfile Off +# +#EnableMMAP off +#EnableSendfile on + +# Secure (SSL/TLS) connections +#Include conf/extra/httpd-ssl.conf +# +# Note: The following must must be present to support +# starting without SSL on platforms with no /dev/random equivalent +# but a statically compiled-in mod_ssl. +# + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + +# +# uncomment out the below to deal with user agents that deliberately +# violate open standards by misusing DNT (DNT *must* be a specific +# end-user choice) +# +# +#BrowserMatch "MSIE 10.0;" bad_DNT +# +# +#RequestHeader unset DNT env=bad_DNT +# + + + +# http redirect to https +# UNFORTUNATELY this is not playing nicely with Elasticsearch and is +# disabled for now. +# Listen 80 +# +# ServerName MezaHttpRedirect +# Redirect "/" "https://INSERT-DOMAIN-OR-IP/" +# + +# main handling via https +Listen 443 + + SSLEngine on + SSLCertificateFile /etc/pki/tls/certs/meza.crt + SSLCertificateKeyFile /etc/pki/tls/private/meza.key + + + + # + AllowOverride All + + # + Options Indexes FollowSymLinks + + # Controls who can get stuff from this server. + Require all granted + + # Disable directory browsing + Options All -Indexes + + + DocumentRoot /opt/meza/htdocs + ServerName Meza + + # ADD SPECIAL CONFIG BELOW + + + +# Allow non-https access via port 9000. This port is NOT accessible +# externally (e.g. 9000 is not opened in the firewall). This port +# is to be used by Parsoid for non-SSL traffic internally. +Listen 9000 + + + + # + AllowOverride All + + # + Options Indexes FollowSymLinks + + # Controls who can get stuff from this server. + Require all granted + + # Disable directory browsing + Options All -Indexes + + + DocumentRoot /opt/meza/htdocs + ServerName MezaParsoidEntryPoint + + +# Open port for reverse proxy for elasticsearch read-only +Listen 8008 + + ServerName ElasticsearchExternal + + + BalancerMember http://127.0.0.1:9200 max=1 retry=5 + + + Order Allow,Deny + Allow from all + AuthType Basic + AuthName "Authenticated proxy" + AuthUserFile /etc/httpd/.htpasswd + Require valid-user + + + # ES plugins kopf and head won't allow queries with request bodies in + # GET requests, which means it's impossible to do more complex queries. + # I'm not sure if it's a good idea to have POST/PUT/DELETE available in + # production, but for pre-v1.0 it's good to be able to easily access + # the ES API. + # + # order deny,allow + # deny from all + # + + + + ProxyPass / balancer://main/ + ProxyPassReverse / balancer://main/ + + + +# +# Handle files ending in .php, .php5, .php6, etc with PHP +# + + SetHandler application/x-httpd-php + + + + Order allow,deny + Deny from all + + + +# Don't allow access to images directories. Will allow access via img_auth.php + + Order Allow,Deny + Deny From All + + diff --git a/scripts/initd_parsoid.sh b/config/core/initd_parsoid.sh old mode 100644 new mode 100755 similarity index 100% rename from scripts/initd_parsoid.sh rename to config/core/initd_parsoid.sh diff --git a/scripts/localsettings.js b/config/core/localsettings.js similarity index 96% rename from scripts/localsettings.js rename to config/core/localsettings.js index 4bb4191be..59158d16f 100644 --- a/scripts/localsettings.js +++ b/config/core/localsettings.js @@ -18,7 +18,10 @@ exports.setup = function(parsoidConfig) { var wikis = fs.readdirSync( '/opt/meza/htdocs/wikis' ); // Domain, which will be setup by the meza installer - var domain = 'INSERTED_BY_VE_SCRIPT'; + var domain = "http://" + fs.readFileSync( + '/opt/meza/config/local/domain', + { encoding: 'utf8' } + ).trim() + ":9000/"; // loop through all wiki IDs and do setMwApi for ( var i = 0; i < wikis.length; i++ ) { diff --git a/config/core/logrotated_httpd b/config/core/logrotated_httpd new file mode 100644 index 000000000..1f159ccae --- /dev/null +++ b/config/core/logrotated_httpd @@ -0,0 +1,11 @@ +/var/log/httpd/*log { + missingok + notifempty + sharedscripts + daily + rotate 7 + postrotate + /sbin/service httpd reload > /var/log/httpd/rotate 2>&1 || true + endscript + compress +} \ No newline at end of file diff --git a/scripts/config/memcached b/config/core/memcached similarity index 100% rename from scripts/config/memcached rename to config/core/memcached diff --git a/config/core/my.cnf b/config/core/my.cnf new file mode 100644 index 000000000..6b8018331 --- /dev/null +++ b/config/core/my.cnf @@ -0,0 +1,24 @@ +# For advice on how to change settings please see +# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html +# + +[client] + +port = 3306 +socket = /var/lib/mysql/mysql.sock + + +[mysqld] + +# Connection and Thread variables + +port = 3306 +socket = /var/lib/mysql/mysql.sock +datadir = /opt/meza/data/mysql + +# Recommended in standard MySQL setup +sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES + +[mysqld_safe] +log-error=/var/log/mysqld.log +pid-file=/var/run/mysqld/mysqld.pid diff --git a/scripts/php.ini-production b/config/core/php.ini similarity index 99% rename from scripts/php.ini-production rename to config/core/php.ini index a7df53a31..43d06d0fb 100644 --- a/scripts/php.ini-production +++ b/config/core/php.ini @@ -1832,7 +1832,7 @@ ldap.max_links = -1 [opcache] ; add OPcache file location -zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/opcache.so +zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so ; Determines if Zend OPCache is enabled opcache.enable=1 diff --git a/config/local/README.md b/config/local/README.md new file mode 100644 index 000000000..e2da04a79 --- /dev/null +++ b/config/local/README.md @@ -0,0 +1,4 @@ +Local configuration directory +============================= + +This directory is used for configuration of your specific meza instance. Other configuration files outside this should not be edited, but this is for individual customization of the entire meza setup. Customization of specific wikis is handled in `/opt/meza/htdocs/wikis//config`. diff --git a/config/template/LandingPage.php b/config/template/LandingPage.php new file mode 100644 index 000000000..52d3df01c --- /dev/null +++ b/config/template/LandingPage.php @@ -0,0 +1,31 @@ +meza on github", + "enterprisemediawiki.org", +); + +// Array of admin email addresses to display in the footer +// $blenderAdmins = array( +// "admin@example.com" => "Admin Name", +// ); diff --git a/scripts/config/SAML/SAML-LocalSettings-Additions.php b/config/template/SAML-postLocalSettings.php similarity index 81% rename from scripts/config/SAML/SAML-LocalSettings-Additions.php rename to config/template/SAML-postLocalSettings.php index cdc27d70d..5357cbeef 100644 --- a/scripts/config/SAML/SAML-LocalSettings-Additions.php +++ b/config/template/SAML-postLocalSettings.php @@ -43,14 +43,17 @@ //), ); - - require_once $egExtensionLoader->registerLegacyExtension( - 'AccessDenied', - 'https://github.com/JamesMontalvo3/AccessDenied.git', - 'master' - ); - $egAccessDeniedViewerGroup = "Viewer"; - $wgGroupPermissions['Viewer'] = $wgGroupPermissions['user']; - $wgGroupPermissions['Contributor'] = $wgGroupPermissions['user']; + $GLOBALS['wgHooks']['SpecialPage_initList'][] = function (&$list) { + unset( $list['Userlogout'] ); + unset( $list['Userlogin'] ); + return true; + }; + + $GLOBALS['wgHooks']['PersonalUrls'][] = function (&$personal_urls, &$wgTitle) { + unset( $personal_urls["login"] ); + unset( $personal_urls["logout"] ); + unset( $personal_urls['anonlogin'] ); + return true; + }; } diff --git a/config/template/SAML-preLocalSettings.php b/config/template/SAML-preLocalSettings.php new file mode 100644 index 000000000..fd544ca00 --- /dev/null +++ b/config/template/SAML-preLocalSettings.php @@ -0,0 +1,7 @@ + + +// don't let nobody do no account creatin' +$wgGroupPermissions['*']['createaccount'] = false; +$wgGroupPermissions['user']['createaccount'] = false; +$wgGroupPermissions['sysop']['createaccount'] = false; +$wgGroupPermissions['bureaucrat']['createaccount'] = false; diff --git a/scripts/ifcfg-enp0s8 b/config/template/ifcfg-enp0s8 similarity index 100% rename from scripts/ifcfg-enp0s8 rename to config/template/ifcfg-enp0s8 diff --git a/scripts/ifcfg-eth1 b/config/template/ifcfg-eth1 similarity index 100% rename from scripts/ifcfg-eth1 rename to config/template/ifcfg-eth1 diff --git a/config/template/install.config.example.sh b/config/template/install.config.example.sh new file mode 100644 index 000000000..d1890941f --- /dev/null +++ b/config/template/install.config.example.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# File to setup install.sh without using prompts + + +git_branch="master" + +usergithubtoken="e9191bc6d394d64011273d19f4c6be47eb10e25b" + +mysql_root_pass="testpass" + +mw_api_domain="192.168.56.56" + +mediawiki_git_install="y" + +openssl_self_sign_subject="/C=US/ST=TX/L=Houston/O=EnterpriseMediaWiki/CN=enterprisemediawiki.org" + +slackwebhook="n" diff --git a/config/template/more-extensions.php b/config/template/more-extensions.php new file mode 100644 index 000000000..8c968bf6d --- /dev/null +++ b/config/template/more-extensions.php @@ -0,0 +1,82 @@ +registerLegacyExtension( + "IMSQuery", + "https://github.com/jamesmontalvo3/IMSQuery.git", + "master" +); + + +if ( isset( $mezaLoadSummaryTimeline ) && $mezaLoadSummaryTimeline ) { + + # + # Extension:SummaryTimeline + # + require_once $egExtensionLoader->registerLegacyExtension( + "SummaryTimeline", + "https://github.com/darenwelsh/SummaryTimeline.git", + "tags/v0.2.0" + ); + +} + + +if ( isset( $mezaLoadTOPO ) && $mezaLoadTOPO ) { + + # + # Extension:HideSubPage + # + require_once $egExtensionLoader->registerLegacyExtension( + "HideSubPage", + "https://github.com/emanspeaks/HideSubPage.git", + "master" + ); + + # + # Extension:CrossReference + # + require_once $egExtensionLoader->registerLegacyExtension( + "CrossReference", + "https://github.com/jamesmontalvo3/CrossReference.git", + "master" + ); + + # + # Extension:TreeAndMenu + # + require_once $egExtensionLoader->registerLegacyExtension( + "TreeAndMenu", + "https://github.com/jamesmontalvo3/TreeAndMenu.git", + "master" + ); + + + $wgHooks['BeforePageDisplay'][] = 'wfAddSidebarTree'; + function wfAddSidebarTree( $out, $skin ) { + $title = Title::newFromText( 'SidebarTree', NS_MEDIAWIKI ); + $article = new Article( $title ); + $html = $out->parse( $article->getContent() ); + $out->addHTML( "
$html
" ); + return true; + } + +} diff --git a/config/template/preLocalSettings_allWikis.php b/config/template/preLocalSettings_allWikis.php new file mode 100644 index 000000000..5c420e78e --- /dev/null +++ b/config/template/preLocalSettings_allWikis.php @@ -0,0 +1,25 @@ + - - - - - - - Meza Wikis - - - - - - - - - - - - - - - - -

Meza Wikis

-

Below are all the wikis currently installed on this server.

-
    -$wiki"; - } - } - -?> - - - - - - - - - - -
- - \ No newline at end of file + /path/to/your/output/file.sql` @@ -91,9 +91,29 @@ To transfer files to your server you can use SCP (or PSCP on Windows): This process can be used to import wikis from some types of servers. The authors of this script have only tested it where the remote server is running Windows. -1. `cd /opt/meza` -2. Create `remote-wiki-config.sh` by doing one of the following: - 1. `sudo cp ./scripts/config/remote-wiki-config.example.sh ./remote-wiki-config.sh` and editing the file +1. `cd /opt/meza/config/local` +2. Create `config/local/remote-wiki-config.sh` by doing one of the following: + 1. `sudo cp /opt/meza/config/template/remote-wiki-config.example.sh ./remote-wiki-config.sh` and editing the file 2. `sudo vi remote-wiki-config.sh` and pasting in your pre-built config -3. `cd scripts` +3. `cd /opt/meza/scripts` 4. `sudo bash import-remote-wikis.sh`. You should only need to enter your username and password for the remote server if you filled `remote-wiki-config.sh` + + +## Making a wiki the "primary" wiki + +A wiki can be setup as the "primary" wiki. This means that all other wikis will use its user and interwiki tables. If all wikis are related, and are going to have similar users, you should do this. To make one wiki the primary wiki simply add a file called "primewiki" to the `config/local` directory: + +```bash +cd /opt/meza/config/local +echo "wiki-id" > primewiki +``` + +In this example "wiki-id" is the ID of the wiki you want to be primary. + +Note that if you run `unifyUserTables.php` on a set of wikis that do not share user and interwiki tables, the script will automatically setup the `primewiki` file for you. To run `unifyUserTables.php` perform the following: + +```bash +WIKI=anywiki php /opt/meza/scripts/unifyUserTables.php --prime-wiki=anotherwiki +``` + +In this case above you need to specify any existing wiki at the beginning. This is simply so LocalSettings.php will load properly. Any of your existing wikis will do. After the `--prime-wiki=` add the wiki ID of the wiki you want to be prime. diff --git a/manual/DirectoryStructure.md b/manual/DirectoryStructure.md new file mode 100644 index 000000000..63d40ce4b --- /dev/null +++ b/manual/DirectoryStructure.md @@ -0,0 +1,144 @@ +This is an overview of the directory structure used by a meza server. This does not include every single file, but attempts to list out directories and files used by the meza application. + +``` +/ +|-- etc/ (Parsoid, ES, and MySQL are installed here) +| |-- my.cnf -> /opt/meza/config/core/my.conf +|-- opt/ +| â””-- meza/ (primary installation location for meza) +| |-- config/ +| | |-- core/ (config for meza application, not to be changed by meza admins) +| | | |-- BlenderSettings.php (for landing page) +| | | |-- config.sh (for meza) +| | | |-- elasticsearch.repo +| | | |-- elasticsearch.yml +| | | |-- httpd.conf (for Apache) +| | | |-- initd_parsoid.sh (run Parsoid as daemon) +| | | |-- localsettings.js (configuration for Parsoid) +| | | |-- LocalSettings.php (configuration for MediaWiki) +| | | |-- logrotated_httpd (rotates Apache log files) +| | | |-- memcached +| | | |-- my.cnf (for MySQL) +| | | â””-- php.ini +| | |-- local/ (config for meza instance on a server) +| | | |-- domain +| | | |-- LandingPage.php (site-specific settings for landing page) +| | | |-- postLocalSettings_allWikis.php +| | | |-- preLocalSettings_allWikis.php +| | | |-- primewiki (specifies which wiki is prime for user table, interwiki, etc) +| | | |-- README.md +| | | |-- remote-wiki-config.sh (copy/modify from template directory) +| | | |-- saml20-idp-remote.php (copied/modified from template directory by saml.sh) +| | | |-- saml-setup-config.sh (copy/modify from template directory) +| | | â””-- simplesaml_authsources.php (generated by saml.sh script if using SAML authentication) +| | â””-- template/ +| | |-- ifcfg-enp0s8 (host-only network settings for CentOS 7 on VirtualBox) +| | |-- ifcfg-eth1 (host-only network settings for CentOS 6 on VirtualBox) +| | |-- install.config.example.sh (allow run install.sh without any prompts) +| | |-- LandingPage.php +| | |-- more-extensions.php (example showing how to load non-core extensions) +| | |-- preLocalSettings_allWikis.php +| | |-- remote-wiki-config.example.sh (used to pull data from remote wikis for import) +| | |-- saml20-idp-remote.php (copied to local if using SAML authentication) +| | |-- saml_httpd.conf (added to core/httpd.conf if using SAML (FIXME: don't touch core)) +| | |-- SAML-postLocalSettings.php +| | |-- SAML-preLocalSettings.php +| | |-- saml-setup-config.sh (used to setup SAML authentication with saml.sh if required) +| | â””-- wiki-init/ +| | |-- config/ +| | | |-- favicon.ico +| | | |-- logo.png +| | | |-- postLocalSettings.php +| | | â””-- preLocalSettings.php +| | â””-- images/ +| |-- data/ +| | |-- elasticsearch/ +| | | |-- data/ (indices for ES) +| | | |-- plugins/ (plugins for ES) +| | | â””-- work/ (temp files for ES) +| | |-- mysql/ +| | | â””-- databases/ +| |-- .gitignore +| |-- htdocs/ +| | |-- .htaccess +| | |-- index.php +| | |-- mediawiki/ +| | | |-- extensions/ +| | | |-- images/ (not used by meza, see /opt/meza/htdocs/wikis//images/) +| | | |-- LocalSettings.php -> /opt/meza/config/core/LocalSettings.php +| | | |-- maintenance/ +| | | â””-- (lots of standard MediaWiki stuff) +| | |-- WikiBlender/ (see github/jamesmontalvo3/WikiBlender) +| | | |-- BlenderSettings.php -> /opt/meza/config/core/BlenderSettings.php +| | | |-- .gitignore +| | | |-- includes/ +| | | | |-- Admin.php +| | | | |-- Landing.php +| | | | â””-- WikiBlender.php +| | | |-- index.php +| | | |-- lib/ +| | | |-- masonry.pkgd.min.js +| | | |-- underscore-min.js +| | | |-- WikiBlender.css +| | | â””-- WikiBlender.js +| | â””-- wikis/ +| | |-- demo/ +| | | |-- config/ (config for each wiki) +| | | | |-- favicon.ico +| | | | |-- logo.png +| | | | |-- postLocalSettings.php +| | | | â””-- preLocalSettings.php +| | | â””-- images/ +| | â””-- (other wikis yet to be created, same structure as /opt/meza/htdocs/wikis/demo) +| |-- logs/ +| | |-- _cmd.log (command start/stop times during meza install) +| | |-- _err.log (errors during meza install) +| | |-- _out.log (output from meza install) +| | |-- php.log (PHP logging when debug is on) +| | â””-- user-unify-/ (lots of logging during user unification script) +| |-- manual/ (lots of markdown files for documentation) +| |-- scripts/ +| | |-- create-wiki.sh +| | |-- dev-networking.sh +| | |-- elastic-rebuild-index.sh +| | |-- import-remote-wikis.sh +| | |-- import-wikis.sh +| | |-- install.sh +| | |-- mezaCreateUser.php +| | |-- saml.sh +| | |-- unifyUserTables.php +| | â””-- vmsetupwin.bat +| |-- simplesamlphp/ (everything here is generated by saml.sh, dir doesn't exist if not using SAML) +| â””-- sources/ (source directories for things installed by source) +| |-- ImageMagick/ +| â””-- php-5.6.14/ +|-- tmp/ (Used by at least PHP and MW, probably by other applications) +â””-- var/ + |-- lib/ + | |-- mysql/ + | â””-- mysql.sock (MySQL socket file, used for local connections to MySQL) + â””-- log/ + |-- elasticsearch/ + |-- httpd/ + |-- mail/ + |-- mysqld.log + â””-- messages (system messages on CentOS) +``` + +### Notes + +#### Log files +All logging goes to `/var/log` with one exception. PHP logging is merged into Apache logging. If MW debug is on, PHP logging also goes to `/opt/meza/logs/php.log`. Logging to apache is not done when using command line interface. + +#### MySQL databases +Located in `/opt/meza/data/mysql/`. In previous meza releases, these were in `/var/lib/mysql/`. + +#### Uploaded files +`/opt/meza/htdocs/wikis//images/` + +#### Configuration +Each wiki's config overrides the local meza config which overrides the core meza config. +- (For each wiki): `/opt/meza/htdocs/wikis//config/` +- (For local meza): `/opt/meza/config/local/` +- (Core meza app): `/opt/meza/config/core/` + diff --git a/manual/ElasticsearchPlugins.md b/manual/ElasticsearchPlugins.md new file mode 100644 index 000000000..fe2e480fa --- /dev/null +++ b/manual/ElasticsearchPlugins.md @@ -0,0 +1,34 @@ +# Elasticsearch Plugins + +At present there are four Elasticsearch plugins installed: + +* [Kopf](https://github.com/lmenezes/elasticsearch-kopf) +* [Elasticsearch-head](https://mobz.github.io/elasticsearch-head/) +* [Bigdesk](http://bigdesk.org/) +* [Inquisitor](https://github.com/polyfractal/elasticsearch-inquisitor) + +## Enabling access + +By default Elasticsearch is not accessible from outside the server. In order to access it you need to create an authenticated user by performing the following command: + +``` +sudo htpasswd -c /etc/httpd/.htpasswd +``` + +You will then be prompted to enter a password. Make sure this is a strong password. If you want to create additional users perform the same command without the `-c` option: + +``` +sudo htpasswd /etc/httpd/.htpasswd +``` + +Note that this connection is read-only. You can only perform GET requests to Elasticsearch. + +## Accessing each plugin + +To access each plugin, navigate to the following URIs: + +* Kopf: `http://:8008/_plugin/kopf` +* Head: `http://:8008/_plugin/elasticsearch-head` +* Bigdesk: `http://:8008/_plugin/bigdesk` +* Inquisitor: `http://:8008/_plugin/inquisitor` + diff --git a/manual/installing-additional-extensions.md b/manual/installing-additional-extensions.md new file mode 100644 index 000000000..81799f7d3 --- /dev/null +++ b/manual/installing-additional-extensions.md @@ -0,0 +1,20 @@ +Installing additional extensions +================================ + +meza comes pre-built with many extensions, but if you need additional extensions you can add them to any configuration file. The recommended method for adding extensions to all wikis is to use your "postLocalSettings_allWikis.php" file in `/opt/meza/config/local`. This file may not already exist, but if you add it meza will automatically start using it. + +An example file is located at `/opt/meza/config/template/more-extensions.php`. This shows a method to load extensions for all wikis or just for select wikis. + +After you've moved this file into `postLocalSettings_allWikis.php`, or included it from `postLocalSettings_allWikis.php`, you need to perform the installation. To do that run: + +``` +sudo WIKI= php /opt/meza/htdocs/mediawiki/extensions/ExtensionLoader/updateExtensions.php +``` + +Replace `` with any wiki ID. If the extensions you are installing require database updates (e.g. if their install instructions tell you to run `update.php`) then you will need to run `update.php` for **all wikis**. To do that, run the following: + +``` +sudo WIKI= php /opt/meza/htdocs/mediawiki/maintenance/update.php +``` + +Do the command above for all wiki IDs. diff --git a/scripts/ElasticSearch.sh b/scripts/ElasticSearch.sh index 7f6045e5a..c68c3cdd6 100644 --- a/scripts/ElasticSearch.sh +++ b/scripts/ElasticSearch.sh @@ -58,7 +58,7 @@ cd "$m_meza/scripts" rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch # Add yum repo file -cp ./elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo +ln -s "$m_config/core/elasticsearch.repo" /etc/yum.repos.d/elasticsearch.repo # Install repo yum -y install elasticsearch @@ -84,29 +84,33 @@ echo "******* Adding Elasticsearch configuration *******" # Add host name per https://github.com/elastic/elasticsearch/issues/6611 echo "127.0.0.1 meza" >> /etc/hosts -# Rename the standard config file and copy over our custom config file +# Rename the standard config file and link to our custom file cd /etc/elasticsearch -mv ./elasticsearch.yml ./elasticsearch-old.yml -cd "$m_meza/scripts" -cp ./elasticsearch.yml /etc/elasticsearch/elasticsearch.yml +mv /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch-old.yml +ln -s "$m_config/core/elasticsearch.yml" /etc/elasticsearch/elasticsearch.yml # Make directories called out in elasticsearch.yml # ref: http://elasticsearch-users.115913.n3.nabble.com/Elasticsearch-Not-Working-td4059398.html -cd /var -mkdir data -cd data -mkdir elasticsearch -cd /var -mkdir work -cd work -mkdir elasticsearch -cd /var +mkdir "$m_meza/data/elasticsearch/data" +mkdir "$m_meza/data/elasticsearch/work" +mkdir "$m_meza/data/elasticsearch/plugins" + # Grant elasticsearch user ownership of these new directories -chown -R elasticsearch /var/data/elasticsearch -chown -R elasticsearch /var/work/elasticsearch +chown -R elasticsearch "$m_meza/data/elasticsearch/data" +chown -R elasticsearch "$m_meza/data/elasticsearch/work" +chown -R elasticsearch "$m_meza/data/elasticsearch/plugins" # Start Elasticsearch echo "******* Starting elasticsearch service *******" service elasticsearch start sleep 20 # Waits 10 seconds + + +# install kopf, head, bigdesk and inquisitor plugins +/usr/share/elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf/1.0 +/usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head +/usr/share/elasticsearch/bin/plugin install lukas-vlcek/bigdesk +/usr/share/elasticsearch/bin/plugin install polyfractal/elasticsearch-inquisitor + + diff --git a/scripts/VE.sh b/scripts/VE.sh index aeb2bee92..a920353f6 100644 --- a/scripts/VE.sh +++ b/scripts/VE.sh @@ -21,13 +21,6 @@ do read mw_api_domain done - -# MediaWiki's API URI, for parsoid. Parsoid communicates with MediaWiki PHP API -# via Apache httpd over port 8142. Note: protocol was $mw_api_protocol, but was -# changed to hard-coded http when Parsoid was given it's own port. -mw_api_uri="http://$mw_api_domain:8142/" - - echo "******* Downloading node.js *******" cmd_profile "START node.js build" cd ~/mezadownloads @@ -84,13 +77,12 @@ echo "******* Downloading configuration files *******" cd "$m_meza/scripts" # Copy Parsoid settings from Meza to Parsoid install -cp ./localsettings.js /etc/parsoid/api/localsettings.js +ln -s "$m_config/core/localsettings.js" /etc/parsoid/api/localsettings.js -# Insert proper MediaWiki API URI -# Insert contents of "$mw_api_uri" in place of "<>" -# Note on escape syntax: result="${original_var//text_to_replace/text_to_replace_with} -escaped_mw_api_uri=${mw_api_uri//\//\\\/} # need to replace / with \/ for regex -sed -r -i "s/INSERTED_BY_VE_SCRIPT/$escaped_mw_api_uri/g;" /etc/parsoid/api/localsettings.js +# MediaWiki's API URI, for parsoid. Parsoid communicates with MediaWiki PHP API +# via Apache httpd over port 9000. Note: protocol was $mw_api_protocol, but was +# changed to hard-coded http when Parsoid was given it's own port. +echo "$mw_api_domain" > /opt/meza/config/local/domain # @@ -110,8 +102,7 @@ chown parsoid:parsoid /etc/parsoid -R # https://github.com/narath/brigopedia#setup-visualeditor-extension # Create service script echo "******* Creating parsoid service *******" -cd "$m_meza/scripts" -cp ./initd_parsoid.sh /etc/init.d/parsoid +ln -s "$m_config/core/initd_parsoid.sh" /etc/init.d/parsoid chmod 755 /etc/init.d/parsoid chkconfig --add /etc/init.d/parsoid diff --git a/scripts/apache.sh b/scripts/apache.sh index 9311e409e..70bc3f8fe 100644 --- a/scripts/apache.sh +++ b/scripts/apache.sh @@ -4,109 +4,22 @@ print_title "Starting script apache.sh" -# change to mezadownloads directory -cd ~/mezadownloads - -# -# Download Apache httpd, Apache Portable Runtime (APR) and APR-util -# Note that these links may break when new versions are released -# See httpd [1] and APR [2] list of files to confirm versions before running. -# -# [1] http://www.us.apache.org/dist//httpd/ -# [2] http://www.us.apache.org/dist//apr -# -httpd_version="2.4.16" -apr_version="1.5.2" -aprutil_version="1.5.4" -wget "http://archive.apache.org/dist/httpd/httpd-$httpd_version.tar.gz" -wget "http://archive.apache.org/dist/apr/apr-$apr_version.tar.gz" -wget "http://archive.apache.org/dist/apr/apr-util-$aprutil_version.tar.gz" - - -# -# Unpack and build Apache from source -# -tar -zxvf "httpd-$httpd_version.tar.gz" -tar -zxvf "apr-$apr_version.tar.gz" -tar -zxvf "apr-util-$aprutil_version.tar.gz" -cp -r "apr-$apr_version" "httpd-$httpd_version/srclib/apr" -cp -r "apr-util-$aprutil_version" "httpd-$httpd_version/srclib/apr-util" -mv "httpd-$httpd_version" "$m_meza/sources/httpd-$httpd_version" -cd "$m_meza/sources/httpd-$httpd_version" -cmd_profile "START apache build" -./configure --enable-ssl --enable-so --with-included-apr --with-mpm=event -make -make install -cmd_profile "END apache build" - - -# -# Apache user -# -groupadd www -useradd -G www -r apache -chown -R apache:www /usr/local/apache2 - - # # Setup document root # -chown -R apache:www "$m_htdocs" +chown -R apache:apache "$m_htdocs" chmod -R 775 "$m_htdocs" - -# -# Skip section (not titled) on httpd.conf "Supplemental configuration" -# Skip section titled "httpd-mpm.conf" -# Skip section titled "Vhosts for apache 2.4.12" -# -# @todo: figure out if this section is necessary For now skip section titled "httpd-security.conf" -# - - - -# @todo: pick up from section "Modify config file" - -#### NOT YET COMPLETE #### - - - - -cd /usr/local/apache2/conf - -# -# Commenting out all modifications to httpd.conf. These should all be in -# "meza/scripts/config/httpd.conf" now. Anything -# -# update document root -# sed -r -i 's/\/usr\/local\/apache2\/htdocs/\/var\/www\/meza\/htdocs/g;' ./httpd.conf -# direct apache to execute PHP -# cat $m_meza/scripts/httpd-conf-additions.conf >> ./httpd.conf -# serve index.php as default file -# sed -r -i 's/DirectoryIndex\s*index.html/DirectoryIndex index.php index.html/g;' ./httpd.conf -# modify user that will handle web requests -# sed -r -i 's/User\s*daemon/User apache/g;' ./httpd.conf -# sed -r -i 's/Group\s*daemon/Group www/g;' ./httpd.conf - - # rename default configuration file, get meza config file +cd "$m_apache/conf" mv httpd.conf httpd.default.conf -cp "$m_meza/scripts/config/httpd.conf" ./httpd.conf +ln -s "$m_config/core/httpd.conf" "$m_apache/conf/httpd.conf" # replace INSERT-DOMAIN-OR-IP with domain...or IP address -sed -r -i "s/INSERT-DOMAIN-OR-IP/$mw_api_domain/g;" ./httpd.conf - - -# create service script -cd /etc/init.d -cp "$m_meza/scripts/initd_httpd.sh" ./httpd -chmod +x /etc/init.d/httpd +sed -r -i "s/INSERT-DOMAIN-OR-IP/$mw_api_domain/g;" "$m_config/core/httpd.conf" # create logrotate file -cd /etc/logrotate.d -cp "$m_meza/scripts/logrotated_httpd" ./httpd - -cd "$m_htdocs" +ln -s " $m_config/core/logrotated_httpd" /etc/logrotate.d/httpd # modify firewall rules @@ -125,6 +38,11 @@ then firewall-cmd --zone=public --add-port=http/tcp firewall-cmd --zone=public --add-port=http/tcp --permanent + # access to 8008 for reverse proxy for elasticsearch + firewall-cmd --zone=public --add-port=8008/tcp + firewall-cmd --zone=public --add-port=8008/tcp --permanent + + else echo "Enterprise Linux version 6. Applying rule changes to iptables" @@ -139,5 +57,26 @@ else fi +# +# Below attempts to make SELinux play nice with services. This works for +# elasticsearch, but parsoid runs sooooo sloooow. Disabling SELinux. +# + +# enable SELinux management commands +# yum -y install setroubleshoot-server selinux-policy-devel + +# Make SELinux respect parsoid +# sudo semanage port -a -t http_port_t -p tcp 8000 + +# make SELinux respect elasticsearc +# sudo semanage port -a -t http_port_t -p tcp 9200 +# sudo semanage port -a -t http_port_t -p tcp 9300 + + +# set SELinux to permissive mode permanently and immediately +sed -r -i "s/SELINUX=.*$/SELINUX=permissive/g;" /etc/selinux/config +setenforce permissive + +echo -e "\n\napache.sh complete." # Apache httpd service not started yet. Started in php.sh diff --git a/scripts/commandTimes.js b/scripts/commandTimes.js new file mode 100644 index 000000000..f24c91646 --- /dev/null +++ b/scripts/commandTimes.js @@ -0,0 +1,64 @@ +fs = require('fs') +path = require('path') + +var inputFile = process.argv[2]; + +fs.readFile( inputFile, 'utf8', function (err,data) { + if (err) { + return console.log(err); + } + + var lineDate = function ( line ) { + return new Date( line.substring(0,28) ); + } + + var dateDiff = function ( date1, date2 ) { + var ms = date2 - date1; + var minutes = parseInt( ms / (1000 * 60) ); + var seconds = parseInt( (ms % (1000 * 60)) / 1000 ); + if ( seconds < 10 ) { seconds = "0" + seconds } + return { + duration: minutes + ":" + seconds, + durationMS: ms + }; + } + + + + var lines = data.split("\n"), + lookingFor = "start", + scripts = {}, + script, + diff, + lastLineDate; + + for ( var i = 0; i < lines.length; i++ ) { + + if ( lookingFor === "start" && lines[i].indexOf("START source") !== -1 ) { + script = lines[i].substring( lines[i].lastIndexOf(" ") ); + scripts[script] = {}; + scripts[script].start = lineDate( lines[i] ); + lookingFor = "end"; + } + else if ( lookingFor === "end" && lines[i].indexOf("END source") !== -1 ) { + script = lines[i].substring( lines[i].lastIndexOf(" ") ); + scripts[script].end = lineDate( lines[i] ); + + diff = dateDiff( scripts[script].start, scripts[script].end ) + scripts[script].duration = diff.duration; + scripts[script].durationMS = diff.durationMS; + + lookingFor = "start"; + console.log( script + ": " + scripts[script].duration ); + } + + if ( lines[i].trim() ) { + lastLineDate = lineDate( lines[i] ); + } + } + + var firstLineDate = lineDate( lines[0] ); + var scriptLength = dateDiff( firstLineDate, lastLineDate ); + console.log( "TOTAL: " + scriptLength.duration ); + +}); diff --git a/scripts/config/httpd.conf b/scripts/config/httpd.conf deleted file mode 100644 index a9a2d9c37..000000000 --- a/scripts/config/httpd.conf +++ /dev/null @@ -1,584 +0,0 @@ -# -# This is the main Apache HTTP server configuration file. It contains the -# configuration directives that give the server its instructions. -# See for detailed information. -# In particular, see -# -# for a discussion of each configuration directive. -# -# Do NOT simply read the instructions in here without understanding -# what they do. They're here only as hints or reminders. If you are unsure -# consult the online docs. You have been warned. -# -# Configuration and logfile names: If the filenames you specify for many -# of the server's control files begin with "/" (or "drive:/" for Win32), the -# server will use that explicit path. If the filenames do *not* begin -# with "/", the value of ServerRoot is prepended -- so "logs/access_log" -# with ServerRoot set to "/usr/local/apache2" will be interpreted by the -# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" -# will be interpreted as '/logs/access_log'. - -# -# ServerRoot: The top of the directory tree under which the server's -# configuration, error, and log files are kept. -# -# Do not add a slash at the end of the directory path. If you point -# ServerRoot at a non-local disk, be sure to specify a local disk on the -# Mutex directive, if file-based mutexes are used. If you wish to share the -# same ServerRoot for multiple httpd daemons, you will need to change at -# least PidFile. -# -ServerRoot "/usr/local/apache2" - -# -# Mutex: Allows you to set the mutex mechanism and mutex file directory -# for individual mutexes, or change the global defaults -# -# Uncomment and change the directory if mutexes are file-based and the default -# mutex file directory is not on a local disk or is not appropriate for some -# other reason. -# -# Mutex default:logs - - -# -# Dynamic Shared Object (DSO) Support -# -# To be able to use the functionality of a module which was built as a DSO you -# have to place corresponding `LoadModule' lines at this location so the -# directives contained in it are actually available _before_ they are used. -# Statically compiled modules (those listed by `httpd -l') do not need -# to be loaded here. -# -# Example: -# LoadModule foo_module modules/mod_foo.so -# -LoadModule authn_file_module modules/mod_authn_file.so -#LoadModule authn_dbm_module modules/mod_authn_dbm.so -#LoadModule authn_anon_module modules/mod_authn_anon.so -#LoadModule authn_dbd_module modules/mod_authn_dbd.so -#LoadModule authn_socache_module modules/mod_authn_socache.so -LoadModule authn_core_module modules/mod_authn_core.so -LoadModule authz_host_module modules/mod_authz_host.so -LoadModule authz_groupfile_module modules/mod_authz_groupfile.so -LoadModule authz_user_module modules/mod_authz_user.so -#LoadModule authz_dbm_module modules/mod_authz_dbm.so -#LoadModule authz_owner_module modules/mod_authz_owner.so -#LoadModule authz_dbd_module modules/mod_authz_dbd.so -LoadModule authz_core_module modules/mod_authz_core.so -LoadModule access_compat_module modules/mod_access_compat.so -LoadModule auth_basic_module modules/mod_auth_basic.so -#LoadModule auth_form_module modules/mod_auth_form.so -#LoadModule auth_digest_module modules/mod_auth_digest.so -#LoadModule allowmethods_module modules/mod_allowmethods.so -#LoadModule file_cache_module modules/mod_file_cache.so -#LoadModule cache_module modules/mod_cache.so -#LoadModule cache_disk_module modules/mod_cache_disk.so -#LoadModule cache_socache_module modules/mod_cache_socache.so -#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so -#LoadModule socache_dbm_module modules/mod_socache_dbm.so -#LoadModule socache_memcache_module modules/mod_socache_memcache.so -#LoadModule macro_module modules/mod_macro.so -#LoadModule dbd_module modules/mod_dbd.so -#LoadModule dumpio_module modules/mod_dumpio.so -#LoadModule buffer_module modules/mod_buffer.so -#LoadModule ratelimit_module modules/mod_ratelimit.so -LoadModule reqtimeout_module modules/mod_reqtimeout.so -#LoadModule ext_filter_module modules/mod_ext_filter.so -#LoadModule request_module modules/mod_request.so -#LoadModule include_module modules/mod_include.so -LoadModule filter_module modules/mod_filter.so -#LoadModule substitute_module modules/mod_substitute.so -#LoadModule sed_module modules/mod_sed.so -#LoadModule deflate_module modules/mod_deflate.so -LoadModule mime_module modules/mod_mime.so -LoadModule log_config_module modules/mod_log_config.so -#LoadModule log_debug_module modules/mod_log_debug.so -#LoadModule logio_module modules/mod_logio.so -LoadModule env_module modules/mod_env.so -#LoadModule expires_module modules/mod_expires.so -LoadModule headers_module modules/mod_headers.so -#LoadModule unique_id_module modules/mod_unique_id.so -LoadModule setenvif_module modules/mod_setenvif.so -LoadModule version_module modules/mod_version.so -#LoadModule remoteip_module modules/mod_remoteip.so -#LoadModule proxy_module modules/mod_proxy.so -#LoadModule proxy_connect_module modules/mod_proxy_connect.so -#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so -#LoadModule proxy_http_module modules/mod_proxy_http.so -#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so -#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so -#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so -#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so -#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so -#LoadModule proxy_express_module modules/mod_proxy_express.so -#LoadModule session_module modules/mod_session.so -#LoadModule session_cookie_module modules/mod_session_cookie.so -#LoadModule session_dbd_module modules/mod_session_dbd.so -#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so -LoadModule ssl_module modules/mod_ssl.so -#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so -#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so -#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so -#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so -LoadModule unixd_module modules/mod_unixd.so -#LoadModule dav_module modules/mod_dav.so -LoadModule status_module modules/mod_status.so -LoadModule autoindex_module modules/mod_autoindex.so -#LoadModule info_module modules/mod_info.so -#LoadModule cgid_module modules/mod_cgid.so -#LoadModule dav_fs_module modules/mod_dav_fs.so -#LoadModule vhost_alias_module modules/mod_vhost_alias.so -#LoadModule negotiation_module modules/mod_negotiation.so -LoadModule dir_module modules/mod_dir.so -#LoadModule actions_module modules/mod_actions.so -#LoadModule speling_module modules/mod_speling.so -#LoadModule userdir_module modules/mod_userdir.so -LoadModule alias_module modules/mod_alias.so -LoadModule rewrite_module modules/mod_rewrite.so -LoadModule php5_module modules/libphp5.so - - -# -# If you wish httpd to run as a different user or group, you must run -# httpd as root initially and it will switch. -# -# User/Group: The name (or #number) of the user/group to run httpd as. -# It is usually good practice to create a dedicated user and group for -# running httpd, as with most system services. -# -User apache -Group www - - - -# 'Main' server configuration -# -# The directives in this section set up the values used by the 'main' -# server, which responds to any requests that aren't handled by a -# definition. These values also provide defaults for -# any containers you may define later in the file. -# -# All of these directives may appear inside containers, -# in which case these default settings will be overridden for the -# virtual host being defined. -# - -# -# ServerAdmin: Your address, where problems with the server should be -# e-mailed. This address appears on some server-generated pages, such -# as error documents. e.g. admin@your-domain.com -# -ServerAdmin you@example.com - -# -# ServerName gives the name and port that the server uses to identify itself. -# This can often be determined automatically, but we recommend you specify -# it explicitly to prevent problems during startup. -# -# If your host doesn't have a registered DNS name, enter its IP address here. -# -#ServerName www.example.com:80 - -# -# Deny access to the entirety of your server's filesystem. You must -# explicitly permit access to web content directories in other -# blocks below. -# - - AllowOverride none - Require all denied - - -# -# Note that from this point forward you must specifically allow -# particular features to be enabled - so if something's not working as -# you might expect, make sure that you have specifically enabled it -# below. -# - -# -# DocumentRoot: The directory out of which you will serve your -# documents. By default, all requests are taken from this directory, but -# symbolic links and aliases may be used to point to other locations. -# -# DocumentRoot "/opt/meza/htdocs" -# -# # -# # Possible values for the Options directive are "None", "All", -# # or any combination of: -# # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews -# # -# # Note that "MultiViews" must be named *explicitly* --- "Options All" -# # doesn't give it to you. -# # -# # The Options directive is both complicated and important. Please see -# # http://httpd.apache.org/docs/2.4/mod/core.html#options -# # for more information. -# # -# Options Indexes FollowSymLinks - -# # -# # AllowOverride controls what directives may be placed in .htaccess files. -# # It can be "All", "None", or any combination of the keywords: -# # AllowOverride FileInfo AuthConfig Limit -# # -# AllowOverride all - -# # -# # Controls who can get stuff from this server. -# # -# Require all granted - -# # -# # Disable directory browsing -# # -# Options All -Indexes - -# - -# -# DirectoryIndex: sets the file that Apache will serve if a directory -# is requested. -# - - DirectoryIndex index.php index.html - - -# -# The following lines prevent .htaccess and .htpasswd files from being -# viewed by Web clients. -# - - Require all denied - - -# -# ErrorLog: The location of the error log file. -# If you do not specify an ErrorLog directive within a -# container, error messages relating to that virtual host will be -# logged here. If you *do* define an error logfile for a -# container, that host's errors will be logged there and not here. -# -ErrorLog "logs/error_log" - -# -# LogLevel: Control the number of messages logged to the error_log. -# Possible values include: debug, info, notice, warn, error, crit, -# alert, emerg. -# -LogLevel warn - - - # - # The following directives define some format nicknames for use with - # a CustomLog directive (see below). - # - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%h %l %u %t \"%r\" %>s %b" common - - - # You need to enable mod_logio.c to use %I and %O - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio - - - # - # The location and format of the access logfile (Common Logfile Format). - # If you do not define any access logfiles within a - # container, they will be logged here. Contrariwise, if you *do* - # define per- access logfiles, transactions will be - # logged therein and *not* in this file. - # - CustomLog "logs/access_log" common - - # - # If you prefer a logfile with access, agent, and referer information - # (Combined Logfile Format) you can use the following directive. - # - #CustomLog "logs/access_log" combined - - - - # - # Redirect: Allows you to tell clients about documents that used to - # exist in your server's namespace, but do not anymore. The client - # will make a new request for the document at its new location. - # Example: - # Redirect permanent /foo http://www.example.com/bar - - # - # Alias: Maps web paths into filesystem paths and is used to - # access content that does not live under the DocumentRoot. - # Example: - # Alias /webpath /full/filesystem/path - # - # If you include a trailing / on /webpath then the server will - # require it to be present in the URL. You will also likely - # need to provide a section to allow access to - # the filesystem path. - - # - # ScriptAlias: This controls which directories contain server scripts. - # ScriptAliases are essentially the same as Aliases, except that - # documents in the target directory are treated as applications and - # run by the server when requested rather than as documents sent to the - # client. The same rules about trailing "/" apply to ScriptAlias - # directives as to Alias. - # - ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/" - - - - - # - # ScriptSock: On threaded servers, designate the path to the UNIX - # socket used to communicate with the CGI daemon of mod_cgid. - # - #Scriptsock cgisock - - -# -# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased -# CGI directory exists, if you have that configured. -# - - AllowOverride None - Options None - Require all granted - - - - # - # TypesConfig points to the file containing the list of mappings from - # filename extension to MIME-type. - # - TypesConfig conf/mime.types - - # - # AddType allows you to add to or override the MIME configuration - # file specified in TypesConfig for specific file types. - # - #AddType application/x-gzip .tgz - # - # AddEncoding allows you to have certain browsers uncompress - # information on the fly. Note: Not all browsers support this. - # - #AddEncoding x-compress .Z - #AddEncoding x-gzip .gz .tgz - # - # If the AddEncoding directives above are commented-out, then you - # probably should define those extensions to indicate media types: - # - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz - - # - # AddHandler allows you to map certain file extensions to "handlers": - # actions unrelated to filetype. These can be either built into the server - # or added with the Action directive (see below) - # - # To use CGI scripts outside of ScriptAliased directories: - # (You will also need to add "ExecCGI" to the "Options" directive.) - # - #AddHandler cgi-script .cgi - - # For type maps (negotiated resources): - #AddHandler type-map var - - # - # Filters allow you to process content before it is sent to the client. - # - # To parse .shtml files for server-side includes (SSI): - # (You will also need to add "Includes" to the "Options" directive.) - # - #AddType text/html .shtml - #AddOutputFilter INCLUDES .shtml - - -# -# The mod_mime_magic module allows the server to use various hints from the -# contents of the file itself to determine its type. The MIMEMagicFile -# directive tells the module where the hint definitions are located. -# -#MIMEMagicFile conf/magic - -# -# Customizable error responses come in three flavors: -# 1) plain text 2) local redirects 3) external redirects -# -# Some examples: -#ErrorDocument 500 "The server made a boo boo." -#ErrorDocument 404 /missing.html -#ErrorDocument 404 "/cgi-bin/missing_handler.pl" -#ErrorDocument 402 http://www.example.com/subscription_info.html -# - -# -# MaxRanges: Maximum number of Ranges in a request before -# returning the entire resource, or one of the special -# values 'default', 'none' or 'unlimited'. -# Default setting is to accept 200 Ranges. -#MaxRanges unlimited - -# -# EnableMMAP and EnableSendfile: On systems that support it, -# memory-mapping or the sendfile syscall may be used to deliver -# files. This usually improves server performance, but must -# be turned off when serving from networked-mounted -# filesystems or if support for these functions is otherwise -# broken on your system. -# Defaults: EnableMMAP On, EnableSendfile Off -# -#EnableMMAP off -#EnableSendfile on - -# Supplemental configuration -# -# The configuration files in the conf/extra/ directory can be -# included to add extra features or to modify the default configuration of -# the server, or you may simply copy their contents here and change as -# necessary. - -# Server-pool management (MPM specific) -#Include conf/extra/httpd-mpm.conf - -# Multi-language error messages -#Include conf/extra/httpd-multilang-errordoc.conf - -# Fancy directory listings -#Include conf/extra/httpd-autoindex.conf - -# Language settings -#Include conf/extra/httpd-languages.conf - -# User home directories -#Include conf/extra/httpd-userdir.conf - -# Real-time info on requests and configuration -#Include conf/extra/httpd-info.conf - -# Virtual hosts -#Include conf/extra/httpd-vhosts.conf - -# Local access to the Apache HTTP Server Manual -#Include conf/extra/httpd-manual.conf - -# Distributed authoring and versioning (WebDAV) -#Include conf/extra/httpd-dav.conf - -# Various default settings -#Include conf/extra/httpd-default.conf - -# Configure mod_proxy_html to understand HTML4/XHTML1 - -Include conf/extra/proxy-html.conf - - -# Secure (SSL/TLS) connections -#Include conf/extra/httpd-ssl.conf -# -# Note: The following must must be present to support -# starting without SSL on platforms with no /dev/random equivalent -# but a statically compiled-in mod_ssl. -# - -SSLRandomSeed startup builtin -SSLRandomSeed connect builtin - -# -# uncomment out the below to deal with user agents that deliberately -# violate open standards by misusing DNT (DNT *must* be a specific -# end-user choice) -# -# -#BrowserMatch "MSIE 10.0;" bad_DNT -# -# -#RequestHeader unset DNT env=bad_DNT -# - - - - -# http redirect to https -# UNFORTUNATELY this is not playing nicely with Elasticsearch and is -# disabled for now. -# Listen 80 -# -# ServerName MezaHttpRedirect -# Redirect "/" "https://INSERT-DOMAIN-OR-IP/" -# - -# main handling via https -Listen 443 - - SSLEngine on - SSLCertificateFile /etc/pki/tls/certs/meza.crt - SSLCertificateKeyFile /etc/pki/tls/private/meza.key - - - - # - AllowOverride All - - # - Options Indexes FollowSymLinks - - # Controls who can get stuff from this server. - Require all granted - - # Disable directory browsing - Options All -Indexes - - - DocumentRoot /opt/meza/htdocs - ServerName Meza - - # ADD SPECIAL CONFIG BELOW - - - -# Allow non-https access via port 8142. This port is NOT accessible -# externally (e.g. 8142 is not opened in the firewall). This port -# is to be used by Parsoid for non-SSL traffic internally. -Listen 8142 - - - - # - AllowOverride All - - # - Options Indexes FollowSymLinks - - # Controls who can get stuff from this server. - Require all granted - - # Disable directory browsing - Options All -Indexes - - - DocumentRoot /opt/meza/htdocs - ServerName MezaParsoidEntryPoint - - - -# -# Handle files ending in .php, .php5, .php6, etc with PHP -# - - SetHandler application/x-httpd-php - - - - Order allow,deny - Deny from all - - - -# Don't allow access to images directories. Will allow access via img_auth.php - - Order Allow,Deny - Deny From All - - diff --git a/scripts/create-wiki.sh b/scripts/create-wiki.sh index 2053e42b8..6df6360e9 100644 --- a/scripts/create-wiki.sh +++ b/scripts/create-wiki.sh @@ -24,7 +24,7 @@ fi # and thus it needs to know how to get to the config.sh script on it's own # DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$DIR/config.sh" +source "/opt/meza/config/core/config.sh" # Set $imports_dir to "new", so import-wikis.sh won't attempt to import existing wikis diff --git a/setup.sh b/scripts/dev-networking.sh similarity index 96% rename from setup.sh rename to scripts/dev-networking.sh index 03c66c9d9..f0b5be7eb 100644 --- a/setup.sh +++ b/scripts/dev-networking.sh @@ -56,7 +56,7 @@ sed -r -i 's/NM_CONTROLLED=yes/NM_CONTROLLED=no/g;' "./$network_adapter1" # note: prefix with \ removes root's alias in .bashrc to "cp -i" which forces cp # to ask the user if they want to overwrite existing. We do want to overwrite. -\cp "/root/mezadownloads/meza/scripts/$network_adapter2" "./$network_adapter2" +\cp "/root/mezadownloads/meza/config/template/$network_adapter2" "./$network_adapter2" # modify IP address as required: sed -r -i "s/IPADDR=192.168.56.56/IPADDR=$ipaddr/g;" "./$network_adapter2" diff --git a/scripts/elastic-build-index.sh b/scripts/elastic-build-index.sh index 4e1206410..34576c5cd 100644 --- a/scripts/elastic-build-index.sh +++ b/scripts/elastic-build-index.sh @@ -2,16 +2,15 @@ bash printTitle.sh "Begin $0" echo "******* Generating elasticsearch index *******" -# Add "$wgDisableSearchUpdate = true;" -sed -r -i 's/false/true/g;' "$m_htdocs/wikis/$wiki_id/config/disableSearchUpdate.php" - +# disable search update in wiki-specific postLocalSettings +echo "\$wgDisableSearchUpdate = true;" >> "$m_htdocs/wikis/$wiki_id/config/postLocalSettings.php" # Run script to generate elasticsearch index cd "$m_mediawiki" -WIKI="$wiki_id" php "$m_mediawiki/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php" +WIKI="$wiki_id" php "$m_mediawiki/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php" --startOver -# Remove $wgDisableSearchUpdate = true (updates should start heading to elasticsearch) -sed -r -i 's/true/false/g;' "$m_htdocs/wikis/$wiki_id/config/disableSearchUpdate.php" +# Remove search-update disable in wiki-specific postLocalSettings +sed -r -i 's/\$wgDisableSearchUpdate = true;//g;' "$m_htdocs/wikis/$wiki_id/config/postLocalSettings.php" # Bootstrap the search index # diff --git a/scripts/elastic-rebuild-index.sh b/scripts/elastic-rebuild-index.sh new file mode 100644 index 000000000..4b3b7c425 --- /dev/null +++ b/scripts/elastic-rebuild-index.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# + +# must be root or sudoer +if [ "$(whoami)" != "root" ]; then + echo "Try running this script with sudo: \"sudo bash import-wiki.sh\"" + exit 1 +fi + + +# If /usr/local/bin is not in PATH then add it +# Ref enterprisemediawiki/meza#68 "Run install.sh with non-root user" +if [[ $PATH != *"/usr/local/bin"* ]]; then + PATH="/usr/local/bin:$PATH" +fi + + +# +# For now this script is not called within the same shell as install.sh +# and thus it needs to know how to get to the config.sh script on it's own +# +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source "/opt/meza/config/core/config.sh" + + +while [ -z "$wiki_id" ]; do + echo "Please enter the ID of the wiki needing index rebuilding:" + read wiki_id_test + if [ ! -z "$wiki_id_test" ] && [ -d "$m_htdocs/wikis/$wiki_id_test" ]; then + wiki_id="$wiki_id_test" + fi +done + +echo "Rebuilding index for $wiki_id" + +source "$m_meza/scripts/elastic-build-index.sh" diff --git a/scripts/extensions.sh b/scripts/extensions.sh index 2fc92a4a2..9c43cf170 100644 --- a/scripts/extensions.sh +++ b/scripts/extensions.sh @@ -10,7 +10,7 @@ print_title "Starting script extensions.sh" # Since SMW is not installed yet, we need to temporarily remove # the enableSemantics() function in LocalSettings.php # -sed -r -i 's/^enableSemantics/\/\/enableSemantics/;' "$m_mediawiki/LocalSettings.php" +sed -r -i 's/^enableSemantics/\/\/enableSemantics/;' "$m_config/core/LocalSettings.php" # @@ -20,8 +20,10 @@ echo -e "\n\nCreating new wiki called \"Demo Wiki\"" imports_dir="new" wiki_id="demo" wiki_name="Demo Wiki" +temp_slack="$slackwebhook" # don't notify when Demo Wiki is created. +slackwebhook="n" source "$m_meza/scripts/create-wiki.sh" - +slackwebhook="$temp_slack" # Clone ExtensionLoader echo -e "\n\n## meza: Install ExtensionLoader and apply changes to MW settings" @@ -57,7 +59,7 @@ echo -e "\n\n## meza: Install composer-supported extensions" cd "$m_mediawiki" cmd_profile "START extensions composer require" composer require \ - mediawiki/semantic-media-wiki:~2.0 \ + mediawiki/semantic-media-wiki:dev-master#787d70fb7f1c1db800e02e0dde0eee8ccc4b7e95 \ mediawiki/semantic-result-formats:~2.0 \ mediawiki/sub-page-list:~1.1 \ mediawiki/semantic-meeting-minutes:~0.3 \ @@ -66,7 +68,7 @@ cmd_profile "END extensions composer require" # Now do enableSemantics()...uncomment function -sed -r -i 's/^\/\/enableSemantics/enableSemantics/;' "$m_mediawiki/LocalSettings.php" +sed -r -i 's/^\/\/enableSemantics/enableSemantics/;' "$m_config/core/LocalSettings.php" # update database @@ -76,7 +78,7 @@ WIKI=demo php maintenance/update.php --quick # Import pages required for SemanticMeetingMinutes and rebuild indices echo -e "\n\n## meza: import pages for SemanticMeetingMinutes" -WIKI=demo php maintenance/importDump.php < ./extensions/SemanticMeetingMinutes/ImportFiles/import.xml +WIKI=demo php maintenance/importDump.php --report --debug < ./extensions/SemanticMeetingMinutes/ImportFiles/import.xml echo -e "\n\n## meza: rebuildrecentchanges.php" WIKI=demo php maintenance/rebuildrecentchanges.php echo -e "\n\n## meza: Extension:TitleKey rebuildTitleKeys.php" diff --git a/scripts/getDatabaseNameFromSetup.php b/scripts/getDatabaseNameFromSetup.php index 824940413..dafb55406 100644 --- a/scripts/getDatabaseNameFromSetup.php +++ b/scripts/getDatabaseNameFromSetup.php @@ -1,7 +1,7 @@ - SetHandler application/x-httpd-php - - - - Order allow,deny - Deny from all - - - diff --git a/scripts/imagemagick.sh b/scripts/imagemagick.sh index 620d61653..8b6ad4d19 100644 --- a/scripts/imagemagick.sh +++ b/scripts/imagemagick.sh @@ -42,7 +42,7 @@ ldconfig /usr/local/lib # Get xpdf-utils echo "Download xpdf-utils" cd ~/mezadownloads -wget ftp://ftp.foolabs.com/pub/xpdf/xpdfbin-linux-3.04.tar.gz +wget http://mirror.unl.edu/ctan/support/xpdf/xpdfbin-linux-3.04.tar.gz tar xvzf xpdfbin-linux-3.04.tar.gz cd xpdfbin-linux-3.04 diff --git a/scripts/import-remote-wikis.sh b/scripts/import-remote-wikis.sh index ddffb7f60..b10e0ded7 100644 --- a/scripts/import-remote-wikis.sh +++ b/scripts/import-remote-wikis.sh @@ -4,8 +4,8 @@ # application and database servers). # -if [ -f "/opt/meza/remote-wiki-config.sh" ]; then - source "/opt/meza/remote-wiki-config.sh" +if [ -f "/opt/meza/config/local/remote-wiki-config.sh" ]; then + source "/opt/meza/config/local/remote-wiki-config.sh" fi @@ -116,26 +116,51 @@ do read -s remote_db_password done -cd "$full_remote_wikis_path" + + +echo +echo +echo "Announce completion of each wiki on Slack?" +echo "Enter webhook URI or leave blank to opt out:" +read slackwebhook + +if [[ -z "$slackwebhook" ]]; then + slackwebhook="n" +fi echo -e "\n\n\nIMPORTING WIKIS: $which_wikis\n" +cd "$full_remote_wikis_path" + # copy each selected wiki directory, then get database -for wiki in $which_wikis +for wiki_dir in $which_wikis do + + # trim trailing slash from directory name + # ref: http://stackoverflow.com/questions/1848415/remove-slash-from-the-end-of-a-variable + # ref: http://www.network-theory.co.uk/docs/bashref/ShellParameterExpansion.html + wiki=${wiki_dir%/} + # @todo: delete existing wiki data? echo "Starting import of wiki '$wiki'" echo " Getting files..." - cp -r "./$wiki" /root/wikis + rsync -rva "./$wiki/" "/root/wikis/$wiki" + + wiki_pre_localsettings="$full_remote_wikis_path/$wiki/config/preLocalSettings.php" + if [ ! -f "$wiki_pre_localsettings" ]; then + # maintain old method of getting wiki db + echo -e "\nThere is no preLocalSettings.php file; using setup.php instead\n" + wiki_pre_localsettings="$full_remote_wikis_path/$wiki/config/setup.php" + fi - wiki_db=`php /opt/meza/scripts/getDatabaseNameFromSetup.php $full_remote_wikis_path/$wiki/config/setup.php` + wiki_db=`php /opt/meza/scripts/getDatabaseNameFromSetup.php $wiki_pre_localsettings` if [ -z "$wiki_db" ]; then wiki_db="wiki_$wiki" fi echo " Getting database..." - mysqldump -h $remote_db_server -u $remote_db_username -p$remote_db_password $wiki_db > "/root/wikis/$wiki/wiki.sql" + mysqldump -v -h $remote_db_server -u $remote_db_username -p$remote_db_password $wiki_db > "/root/wikis/$wiki/wiki.sql" done diff --git a/scripts/import-wikis.sh b/scripts/import-wikis.sh index 4152cfd09..a2ba4f5b2 100644 --- a/scripts/import-wikis.sh +++ b/scripts/import-wikis.sh @@ -25,7 +25,7 @@ fi # and thus it needs to know how to get to the config.sh script on it's own # DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$DIR/config.sh" +source "/opt/meza/config/core/config.sh" # Prompt user for locations of wiki data @@ -78,7 +78,7 @@ if [ "$imports_dir" = "new" ]; then fi mkdir wikis imports_dir="/tmp/wikis" - cp -avr "$m_meza/wiki-init" "$imports_dir/$wiki_id" + cp -avr "$m_config/template/wiki-init" "$imports_dir/$wiki_id" # get SQL file from MediaWiki echo "Copying MediaWiki tables.sql" @@ -87,6 +87,15 @@ if [ "$imports_dir" = "new" ]; then fi +if [[ -z "$slackwebhook" ]]; then + echo + echo + echo "Announce completion of each wiki on Slack?" + echo "Enter webhook URI or leave blank to opt out:" + read slackwebhook +fi + + # setup configuration variables wikis_install_dir="$m_htdocs/wikis" skipped_wikis="" @@ -98,7 +107,7 @@ skipped_wikis="" # wiki1 # images[/|.tar|.tar.gz] # wiki.sql -# config/ (optional logo.png, favicon.ico, setup.php, CustomSettings.php) +# config/ (optional logo.png, favicon.ico, preLocalSettings.php, postLocalSettings.php) # wiki2 # ... # wikiN @@ -136,34 +145,40 @@ for d in */ ; do mkdir "$wiki_install_path/config" fi - # check if logo.png, favicon.ico, setup.php and CustomSettings.php exist. Else use defaults + # check if logo.png, favicon.ico, preLocalSettings.php and postLocalSettings_allWikis.php exist. Else use defaults if [ ! -f "$wiki_install_path/config/logo.png" ]; then - cp "$m_meza/wiki-init/config/logo.png" "$wiki_install_path/config/logo.png" + cp "$m_config/template/wiki-init/config/logo.png" "$wiki_install_path/config/logo.png" fi if [ ! -f "$wiki_install_path/config/favicon.ico" ]; then - cp "$m_meza/wiki-init/config/favicon.ico" "$wiki_install_path/config/favicon.ico" + cp "$m_config/template/wiki-init/config/favicon.ico" "$wiki_install_path/config/favicon.ico" fi - if [ ! -f "$wiki_install_path/config/CustomSettings.php" ]; then - cp "$m_meza/wiki-init/config/CustomSettings.php" "$wiki_install_path/config/CustomSettings.php" + if [ ! -f "$wiki_install_path/config/postLocalSettings.php" ]; then + # old method used overrides.php...rename that file if it exists + if [ -f "$wiki_install_path/config/overrides.php" ]; then + mv "$wiki_install_path/config/overrides.php" "$wiki_install_path/config/postLocalSettings.php" + else + cp "$m_config/template/wiki-init/config/postLocalSettings.php" "$wiki_install_path/config/postLocalSettings.php" + fi fi - if [ ! -f "$wiki_install_path/config/setup.php" ]; then - cp "$m_meza/wiki-init/config/setup.php" "$wiki_install_path/config/setup.php" - fi - if [ ! -f "$wiki_install_path/config/disableSearchUpdate.php" ]; then - cp "$m_meza/wiki-init/config/disableSearchUpdate.php" "$wiki_install_path/config/disableSearchUpdate.php" + if [ ! -f "$wiki_install_path/config/preLocalSettings.php" ]; then + # old method used setup.php...rename that file if it exists + if [ -f "$wiki_install_path/config/setup.php" ]; then + mv "$wiki_install_path/config/setup.php" "$wiki_install_path/config/preLocalSettings.php" + else + cp "$m_config/template/wiki-init/config/preLocalSettings.php" "$wiki_install_path/config/preLocalSettings.php" + fi fi chmod -R 755 "$wiki_install_path/config" - # insert wiki name and auth type into setup.php if it's still "placeholder" - sed -r -i "s/wgSitename = 'placeholder';/wgSitename = '$wiki_name';/g;" "$wiki_install_path/config/setup.php" - sed -r -i "s/mezaAuthType = 'placeholder';/mezaAuthType = 'local_dev';/g;" "$wiki_install_path/config/setup.php" + # insert wiki name and auth type into preLocalSettings.php if it's still "placeholder" + sed -r -i "s/wgSitename = 'placeholder';/wgSitename = '$wiki_name';/g;" "$wiki_install_path/config/preLocalSettings.php" - # If setup.php already existed, it may have a $mezaCustomDBname set.`This - # import script normalizes all database names to be in the form + # If preLocalSettings.php already existed, it may have a $mezaCustomDBname set. + # This import script normalizes all database names to be in the form # "wiki_$wiki_id", so if $wiki_id is "eva" then the database is "wiki_eva" # # This command just comments out the old database name - sed -i "s/\$mezaCustomDBname/\/\/ \$mezaCustomDBname/g;" "$wiki_install_path/config/setup.php" + sed -i "s/\$mezaCustomDBname/\/\/ \$mezaCustomDBname/g;" "$wiki_install_path/config/preLocalSettings.php" # import SQL file # Import database - Ref: https://www.mediawiki.org/wiki/Manual:Restoring_a_wiki_from_backup @@ -191,15 +206,16 @@ for d in */ ; do # does not mention that. Attempting without that. If that is required, then # will have to determine a method to test for completion of rebuild, and run it # in a while loop + rebuild_exception_log="$m_meza/logs/rebuilddata-exceptions-$wiki_id-.log" echo "Running Semantic MediaWiki maintenance script \"rebuildData.php\"" - WIKI="$wiki_id" php "$m_mediawiki/extensions/SemanticMediaWiki/maintenance/rebuildData.php" -d 5 -v + WIKI="$wiki_id" php "$m_mediawiki/extensions/SemanticMediaWiki/maintenance/rebuildData.php" -d 5 -v --ignore-exceptions --exception-log="$rebuild_exception_log" # Run runJobs.php # Note that should prob be removed: Daren saw 12k+ jobs in the queue after performing the above steps echo "Running MediaWiki maintenance script \"runJobs.php\"" - sed -r -i 's/false/true/g;' "$m_htdocs/wikis/$wiki_id/config/disableSearchUpdate.php" + echo "\$wgDisableSearchUpdate = true;" >> "$m_htdocs/wikis/$wiki_id/config/postLocalSettings.php" WIKI="$wiki_id" php "$m_mediawiki/maintenance/runJobs.php" --quick - sed -r -i 's/true/false/g;' "$m_htdocs/wikis/$wiki_id/config/disableSearchUpdate.php" + sed -r -i 's/\$wgDisableSearchUpdate = true;//g;' "$m_htdocs/wikis/$wiki_id/config/postLocalSettings.php" else echo -e "\nSKIPPING SemanticMediaWiki rebuildData.php and runjobs.php (no SMW)" fi @@ -213,7 +229,14 @@ for d in */ ; do echo -e "\nSKIPPING elastic-build-index.sh (no CirrusSearch)" fi - echo -e "\nWiki \"$wiki_id\" has been imported\n" + complete_msg="Wiki '$wiki_id' has been imported" + if [[ -f "$rebuild_exception_log" ]]; then + complete_msg="$complete_msg\nSemanticMediaWiki rebuildData exceptions:\n\n$(cat $rebuild_exception_log)" + fi + echo -e "\n$complete_msg\n" + if [[ ! -z "$slackwebhook" ]]; then + bash "$m_meza/scripts/slack.sh" "$slackwebhook" "$complete_msg" + fi # delete remaining source files? diff --git a/scripts/initd_httpd.sh b/scripts/initd_httpd.sh deleted file mode 100644 index 8e7d929d3..000000000 --- a/scripts/initd_httpd.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# -# Startup script for the Apache Web Server -# -# chkconfig: 345 85 15 -# description: Apache is a World Wide Web server.  It is used to serve \ -#           HTML files and CGI. -# processname: httpd -# pidfile: /usr/local/apache2/logs/httpd.pid -# config: /usr/local/apache2/conf/httpd.conf - -# Source function library. -. /etc/rc.d/init.d/functions - -# See how we were called. -case "$1" in -start) -echo -n "Starting httpd: " -daemon /usr/local/apache2/bin/httpd -DSSL -echo -touch /var/lock/subsys/httpd -;; -stop) -echo -n "Shutting down http: " -killproc httpd -echo -rm -f /var/lock/subsys/httpd -rm -f /usr/local/apache2/logs/httpd.pid -;; -status) -status httpd -;; -restart) -$0 stop -$0 start -;; -reload) -echo -n "Reloading httpd: " -killproc httpd -HUP -echo -;; -*) -echo "Usage: $0 {start|stop|restart|reload|status}" -exit 1 -esac - -exit 0 diff --git a/scripts/install-pear.sh b/scripts/install-pear.sh new file mode 100755 index 000000000..1970ea469 --- /dev/null +++ b/scripts/install-pear.sh @@ -0,0 +1,19 @@ +#!/usr/bin/expect +# +# This script is using "expect" to script user inputs for PEAR +# since PEAR requires user prompts...there is no way to pass the +# information into the script another way (except expect!) +# +# This says when prompted for "1-11, 'all' or Enter to continue:" +# just send the carriage return (e.g. "enter to continue") + +spawn wget -O /tmp/go-pear.phar http://pear.php.net/go-pear.phar +expect eof + +spawn php /tmp/go-pear.phar + +expect "1-12, 'all' or Enter to continue:" +send "\r" +expect eof + +spawn rm /tmp/go-pear.phar diff --git a/scripts/install.sh b/scripts/install.sh index 5660c19e3..4124f4454 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -13,7 +13,9 @@ if [[ $PATH != *"/usr/local/bin"* ]]; then PATH="/usr/local/bin:$PATH" fi -echo -e "\nWelcome to meza v0.4\n" +working_dir=`pwd` + +echo -e "\nWelcome to the meza MediaWiki installer\n" # @@ -45,88 +47,169 @@ else enterprise_linux_version=6 fi + +# Check for install config file before prompts +if [[ ! -z "$1" ]]; then + + # check absolute path + if [[ -f "$1" ]]; then + source "$1" + + # check relative path + elif [[ -f "$working_dir/$1" ]]; then + source "$working_dir/$1" + + # not a valid file name + else + echo + echo "$1 is not a file. Exiting." + exit 1 + fi + +fi + + +# # # # # # # # # # +# BEGIN PROMPTS # +# # # # # # # # # # + # Prompt user for git branch default_git_branch="master" -echo -e "\nType the git branch of meza you want to use and press [ENTER]:" -read -e -i $default_git_branch git_branch -git_branch=${git_branch:-$default_git_branch} + +while [ -z "$git_branch" ]; do + + echo -e "\n\nType the git branch of meza you want to use and press [ENTER]:" + read -e -i $default_git_branch git_branch + git_branch=${git_branch:-$default_git_branch} + +done + # Prompt user for GitHub API personal access token default_usergithubtoken="e9191bc6d394d64011273d19f4c6be47eb10e25b" # From Oscar Rogers -echo -e "\nIf you run this script multiple times from one IP address," -echo -e "you might exceed GitHub's API rate limit." -echo -e "\nYou may just press [ENTER] to use our generic token (which may exceed limits if used too much) or" -echo -e "Visit https://github.com/settings/tokens to generate a new token (with no scopes)." -echo -e "and copy/paste your 40-character token and press [ENTER]: " -read usergithubtoken -usergithubtoken=${usergithubtoken:-$default_usergithubtoken} -# Set Parsoid version. -# This should be able to be set in any of these forms: -# 9260e5d (a sha1 hash) -# tags/v0.4.1 (a tag name) -# master (a branch name) -parsoid_version="ba26a55" +while [ -z "$usergithubtoken" ]; do + + echo -e "\nIf you run this script multiple times from one IP address," + echo -e "you might exceed GitHub's API rate limit." + echo -e "\nYou may just press [ENTER] to use our generic token (which may exceed limits if used too much) or" + echo -e "Visit https://github.com/settings/tokens to generate a new token (with no scopes)." + echo -e "and copy/paste your 40-character token and press [ENTER]: " + read usergithubtoken + usergithubtoken=${usergithubtoken:-$default_usergithubtoken} + +done -# Prompt user for PHP version -default_phpversion="5.6.14" -phpversion=$default_phpversion #hard code version for now based on #24 -# echo -e "\nVisit http://php.net/downloads.php for version numbers" -# echo -e "Type the version of PHP you would like (such as 5.4.42) and press [ENTER]:" -# read -e -i $default_phpversion phpversion -# phpversion=${phpversion:-$default_phpversion} # Prompt user for MySQL password default_mysql_root_pass=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1` -echo -e "\nType your desired MySQL root password" -echo -e "or leave blank for a randomly generated password and press [ENTER]:" -read -s mysql_root_pass -mysql_root_pass=${mysql_root_pass:-$default_mysql_root_pass} -# Prompt user for MW API protocol -- ASSUME HTTPS. Perhaps we'll remove this assumption later -# default_mw_api_protocol="http" -# echo -e "\nType http or https for MW API and press [ENTER]:" -# read -e -i $default_mw_api_protocol mw_api_protocol -# mw_api_protocol=${mw_api_protocol:-$default_mw_api_protocol} -mw_api_protocol=https +while [ -z "$mysql_root_pass" ]; do + + echo -e "\nType your desired MySQL root password" + echo -e "or leave blank for a randomly generated password and press [ENTER]:" + read -s mysql_root_pass + mysql_root_pass=${mysql_root_pass:-$default_mysql_root_pass} + +done + # Prompt user for MW API Domain or IP address -# This for loop attempts to find the correct network adapter from which to pull the domain or IP address -# If multiple adapters are configured (as in our VirtualBox configs), put the most-likely correct one last -for networkadapter in eth0 eth1 enp0s3 enp0s8 -do - if [ -n "ip addr | grep $networkadapter | awk 'NR==2 { print $2 }' | awk '-F[/]' '{ print $1 }'" ]; then - default_mw_api_domain="`ip addr | grep $networkadapter | awk 'NR==2 { print $2 }' | awk '-F[/]' '{ print $1 }'`" +while [ -z "$mw_api_domain" ]; do + + # This for loop attempts to find the correct network adapter from which to pull the domain or IP address + # If multiple adapters are configured (as in our VirtualBox configs), put the most-likely correct one last + for networkadapter in eth0 eth1 enp0s3 enp0s8 + do + if [ -n "ip addr | grep $networkadapter | awk 'NR==2 { print $2 }' | awk '-F[/]' '{ print $1 }'" ]; then + default_mw_api_domain="`ip addr | grep $networkadapter | awk 'NR==2 { print $2 }' | awk '-F[/]' '{ print $1 }'`" + fi + done + + echo -e "\nType domain or IP address of your wiki and press [ENTER]:" + # If the above logic found a value to use as a default suggestion, display it and still prompt user for value + if [ -n "$default_mw_api_domain" ]; then + read -e -i $default_mw_api_domain mw_api_domain + # If the above logic did not find a value to suggest, only read the value in (this fixes #238) + else + read -e mw_api_domain fi + mw_api_domain=${mw_api_domain:-$default_mw_api_domain} + done -echo -e "\nType domain or IP address of your wiki and press [ENTER]:" -# If the above logic found a value to use as a default suggestion, display it and still prompt user for value -if [ -n "$default_mw_api_domain" ]; then - read -e -i $default_mw_api_domain mw_api_domain -# If the above logic did not find a value to suggest, only read the value in (this fixes #238) -else - read -e mw_api_domain -fi -mw_api_domain=${mw_api_domain:-$default_mw_api_domain} # Prompt user for MW install method default_mediawiki_git_install="y" -echo -e "\nInstall MediaWiki with git? (y/n) [ENTER]:" -read -e -i $default_mediawiki_git_install mediawiki_git_install -mediawiki_git_install=${mediawiki_git_install:-$default_mediawiki_git_install} +while [ -z "$mediawiki_git_install" ]; do -echo "" -echo "Next you're going to setup your self-signed certificate for https." -echo "Enter values for each of the following fields. Hit any key to continue." -read -s dummy # is there another way to do this? + echo -e "\nInstall MediaWiki with git? (y/n) [ENTER]:" + read -e -i $default_mediawiki_git_install mediawiki_git_install + mediawiki_git_install=${mediawiki_git_install:-$default_mediawiki_git_install} +done + + +# Prompt for SSL self-signed certificate info +if [ -z "$openssl_self_sign_subject" ]; then + + echo + echo "Next you're going to setup your self-signed certificate for https." + echo "Enter values for each of the following fields. Hit any key to continue." + read -s dummy # is there another way to do this? + + # generate a self-signed SSL signature (for swap-out of a good signature later, of course!) + openssl req -newkey rsa:4096 -nodes -keyout /etc/pki/tls/private/meza.key -x509 -days 365 -out /etc/pki/tls/certs/meza.crt + +else + + openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \ + -subj "$openssl_self_sign_subject" \ + -keyout /etc/pki/tls/private/meza.key -out /etc/pki/tls/certs/meza.crt + +fi -# generate a self-signed SSL signature (for swap-out of a good signature later, of course!) -sudo openssl req -newkey rsa:2048 -nodes -keyout /etc/pki/tls/private/meza.key -x509 -days 365 -out /etc/pki/tls/certs/meza.crt +# Prompt for Slack webhook if it's not "n" and also is empty +# e.g. don't prompt if it has something other than "n" +if [ "$slackwebhook" != "n" ] && [ -z "$slackwebhook" ]; then + echo + echo + echo "Announce completion on Slack?" + echo "Enter webhook URI or leave blank to opt out:" + read slackwebhook + +fi + +if [[ -z "$slackwebhook" ]]; then + slackwebhook="n" +fi + +# # # # # # # # +# END PROMPTS # +# # # # # # # # + + + + +# Prompt user for MW API protocol -- ASSUME HTTPS. Perhaps we'll remove this assumption later +# default_mw_api_protocol="http" +# echo -e "\nType http or https for MW API and press [ENTER]:" +# read -e -i $default_mw_api_protocol mw_api_protocol +# mw_api_protocol=${mw_api_protocol:-$default_mw_api_protocol} +mw_api_protocol=https + + +# Set Parsoid version. +# This should be able to be set in any of these forms: +# 9260e5d (a sha1 hash) +# tags/v0.4.1 (a tag name) +# master (a branch name) +parsoid_version="ba26a55" + +phpversion="5.6.14" # Check if git installed, and install it if required if ! hash git 2>/dev/null; then @@ -212,7 +295,7 @@ fi # Load config constants. Unfortunately right now have to write out full path to # meza since we can't be certain of consistent method of accessing install.sh. -source /opt/meza/scripts/config.sh +source /opt/meza/config/core/config.sh # Enable time sync # Ref: http://www.cyberciti.biz/faq/howto-install-ntp-to-synchronize-server-clock/ @@ -263,6 +346,17 @@ rm -f ~/.composer/auth.json # remove downloads directory (miscellaneous downloaded files) rm -rf /root/mezadownloads +# print time requirements for each script +echo "COMMAND TIMES:" +cmd_times=`node "$m_meza/scripts/commandTimes.js" "$cmdlog"` +echo "$cmd_times" + +# Announce on Slack if a slack webhook provided +if [[ ! -z "$slackwebhook" ]]; then + announce_domain=`cat "$m_config/local/domain"` + bash "$m_meza/scripts/slack.sh" "$slackwebhook" "Your meza installation $announce_domain is complete. Install times:" "$cmd_times" +fi + # Display Most Plusquamperfekt Wiki Pigeon of Victory cat "$m_meza/scripts/pigeon.txt" diff --git a/scripts/logrotated_httpd b/scripts/logrotated_httpd deleted file mode 100644 index 93196f8bc..000000000 --- a/scripts/logrotated_httpd +++ /dev/null @@ -1,12 +0,0 @@ -/opt/meza/logs/httpd/*.log { - rotate 5 - daily - size 128M - compress - delaycompress - sharedscripts - - postrotate - service httpd restart > /dev/null - endscript -} \ No newline at end of file diff --git a/scripts/mediawiki.sh b/scripts/mediawiki.sh index 3ff1f16b0..7c48f5068 100644 --- a/scripts/mediawiki.sh +++ b/scripts/mediawiki.sh @@ -50,14 +50,14 @@ if [ "$mediawiki_git_install" = "y" ]; then cd mediawiki # Checkout latest released version - git checkout tags/1.25.1 + git checkout tags/1.25.5 cmd_profile "END mediawiki git clone" else cmd_profile "START mediawiki get from tarball" - wget http://releases.wikimedia.org/mediawiki/1.25/mediawiki-core-1.25.1.tar.gz + wget http://releases.wikimedia.org/mediawiki/1.25/mediawiki-core-1.25.5.tar.gz mkdir mediawiki - tar xpvf mediawiki-core-1.25.1.tar.gz -C ./mediawiki --strip-components 1 + tar xpvf mediawiki-core-1.25.5.tar.gz -C ./mediawiki --strip-components 1 cd mediawiki cmd_profile "END mediawiki get from tarball" fi @@ -92,13 +92,29 @@ fi # # Copy in LocalSettings.php # -cp "$m_meza/scripts/config/LocalSettings.php" "$m_htdocs/mediawiki/LocalSettings.php" +ln -s "$m_config/core/LocalSettings.php" "$m_htdocs/mediawiki/LocalSettings.php" +cp "$m_config/template/preLocalSettings_allWikis.php" "$m_config/local/preLocalSettings_allWikis.php" # -# Create common database credentials +# Add common database credentials to preLocalSettings_allWikis.php # -echo -e " "$m_htdocs/__common/dbUserPass.php" +echo -e "\n\n" >> "$m_config/local/preLocalSettings_allWikis.php" +echo "// All-wiki db user and password" >> "$m_config/local/preLocalSettings_allWikis.php" +echo "\$wgDBuser = 'root';" >> "$m_config/local/preLocalSettings_allWikis.php" +echo "\$wgDBpassword = '$mysql_root_pass';" >> "$m_config/local/preLocalSettings_allWikis.php" +echo -e "\n\n" >> "$m_config/local/preLocalSettings_allWikis.php" + + +# +# Get WikiBlender +# +echo "Installing WikiBlender" +cd "$m_htdocs" +git clone https://github.com/jamesmontalvo3/WikiBlender.git +cd WikiBlender +ln -s "$m_config/core/BlenderSettings.php" ./BlenderSettings.php +cp "$m_config/template/LandingPage.php" "$m_config/local/LandingPage.php" # end of script diff --git a/scripts/memcached.sh b/scripts/memcached.sh index d416910be..e7936c64e 100644 --- a/scripts/memcached.sh +++ b/scripts/memcached.sh @@ -8,8 +8,7 @@ yum -y install memcached echo "******* Copying memcached config file *******" rm -f /etc/sysconfig/memcached -cd "$m_meza/scripts/config" -cp ./memcached /etc/sysconfig/memcached +ln -s "$m_config/core/memcached" /etc/sysconfig/memcached # Set Memcached to start automatically on boot echo "******* Creating memcached service *******" diff --git a/scripts/mysql-development.cfg b/scripts/mysql-development.cfg deleted file mode 100644 index b66840b96..000000000 --- a/scripts/mysql-development.cfg +++ /dev/null @@ -1,62 +0,0 @@ -# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 -# Configuration name meza-dev generated for jamesmontalvo3@gmail.com at 2015-06-14 20:22:47 - -[mysql] - -# CLIENT # -port = 3306 -socket = /var/lib/mysql/mysql.sock - -[mysqld] - -# GENERAL # -user = mysql -default-storage-engine = InnoDB -socket = /var/lib/mysql/mysql.sock -pid-file = /var/lib/mysql/mysql.pid - -# MyISAM # -key-buffer-size = 32M -myisam-recover = FORCE,BACKUP - -# SAFETY # -max-allowed-packet = 16M -max-connect-errors = 1000000 -skip-name-resolve -sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY -sysdate-is-now = 1 -innodb = FORCE -innodb-strict-mode = 1 - -# DATA STORAGE # -datadir = /var/lib/mysql/ - -# BINARY LOGGING # -log-bin = /var/lib/mysql/mysql-bin -expire-logs-days = 14 -sync-binlog = 1 - -# CACHES AND LIMITS # -tmp-table-size = 32M -max-heap-table-size = 32M -query-cache-type = 0 -query-cache-size = 0 -max-connections = 500 -thread-cache-size = 50 -open-files-limit = 65535 -table-definition-cache = 4096 -table-open-cache = 4096 - -# INNODB # -innodb-flush-method = O_DIRECT -innodb-log-files-in-group = 2 -innodb-log-file-size = 64M -innodb-flush-log-at-trx-commit = 1 -innodb-file-per-table = 1 -innodb-buffer-pool-size = 512M - -# LOGGING # -log-error = /var/lib/mysql/mysql-error.log -log-queries-not-using-indexes = 1 -slow-query-log = 1 -slow-query-log-file = /var/lib/mysql/mysql-slow.log diff --git a/scripts/mysql.sh b/scripts/mysql.sh index 5e3010dd9..91f6ac5b3 100644 --- a/scripts/mysql.sh +++ b/scripts/mysql.sh @@ -33,6 +33,14 @@ fi yum -y install mysql-community-server +# +# Setup storage of MySQL data in /opt/meza/data/mysql +# +chown mysql:mysql "$m_meza/data/mysql" +rm /etc/my.cnf +ln -s "$m_config/core/my.cnf" /etc/my.cnf + + # # Start MySQL service # diff --git a/scripts/php.ini-development b/scripts/php.ini-development deleted file mode 100644 index 901a4f1f4..000000000 --- a/scripts/php.ini-development +++ /dev/null @@ -1,1932 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (C:\windows or C:\winnt) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it's -; much more verbose when it comes to errors. We recommending using the -; development version only in development environments as errors shown to -; application users can inadvertently leak otherwise secure information. - -; This is php.ini-development INI file. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT - -; html_errors -; Default Value: On -; Development Value: On -; Production value: On - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.hash_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; track_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; url_rewriter.tags -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -;user_ini.cache_ttl = 300 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; tags as PHP source which should be processed as such. It is -; generally recommended that should be used and that this feature -; should be disabled, as enabling it may result in issues when generating XML -; documents, however this remains supported for backward compatibility reasons. -; Note that this directive does not control the tags. -; http://php.net/asp-tags -asp_tags = Off - -; The number of significant digits displayed in floating point numbers. -; http://php.net/precision -precision = 14 - -; Output buffering is a mechanism for controlling how much output data -; (excluding headers and cookies) PHP should keep internally before pushing that -; data to the client. If your application's output exceeds this setting, PHP -; will send that data in chunks of roughly the size you specify. -; Turning on this setting and managing its maximum buffer size can yield some -; interesting side-effects depending on your application and web server. -; You may be able to send headers and cookies after you've already sent output -; through print or echo. You also may see performance benefits if your server is -; emitting less packets due to buffered output versus PHP streaming the output -; as it gets it. On production servers, 4096 bytes is a good setting for performance -; reasons. -; Note: Output buffering can also be controlled via Output Buffering Control -; functions. -; Possible Values: -; On = Enabled and buffer is unlimited. (Use with caution) -; Off = Disabled -; Integer = Enables the buffer and sets its maximum size in bytes. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 -; http://php.net/output-buffering -output_buffering = 4096 - -; You can redirect all of the output of your scripts to a function. For -; example, if you set output_handler to "mb_output_handler", character -; encoding will be transparently converted to the specified encoding. -; Setting any output handler automatically turns on output buffering. -; Note: People who wrote portable scripts should not depend on this ini -; directive. Instead, explicitly set the output handler using ob_start(). -; Using this ini directive may cause problems unless you know what script -; is doing. -; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" -; and you cannot use both "ob_gzhandler" and "zlib.output_compression". -; Note: output_handler must be empty if this is set 'On' !!!! -; Instead you must use zlib.output_handler. -; http://php.net/output-handler -;output_handler = - -; Transparent output compression using the zlib library -; Valid values for this option are 'off', 'on', or a specific buffer size -; to be used for compression (default is 4KB) -; Note: Resulting chunk size may vary due to nature of compression. PHP -; outputs chunks that are few hundreds bytes each as a result of -; compression. If you prefer a larger chunk size for better -; performance, enable output_buffering in addition. -; Note: You need to use zlib.output_handler instead of the standard -; output_handler, or otherwise the output will be corrupted. -; http://php.net/zlib.output-compression -zlib.output_compression = Off - -; http://php.net/zlib.output-compression-level -;zlib.output_compression_level = -1 - -; You cannot specify additional output handlers if zlib.output_compression -; is activated here. This setting does the same as output_handler but in -; a different order. -; http://php.net/zlib.output-handler -;zlib.output_handler = - -; Implicit flush tells PHP to tell the output layer to flush itself -; automatically after every output block. This is equivalent to calling the -; PHP function flush() after each and every call to print() or echo() and each -; and every HTML block. Turning this option on has serious performance -; implications and is generally recommended for debugging purposes only. -; http://php.net/implicit-flush -; Note: This directive is hardcoded to On for the CLI SAPI -implicit_flush = Off - -; The unserialize callback function will be called (with the undefined class' -; name as parameter), if the unserializer finds an undefined class -; which should be instantiated. A warning appears if the specified function is -; not defined, or if the function doesn't include/implement the missing class. -; So only set this entry, if you really want to implement such a -; callback-function. -unserialize_callback_func = - -; When floats & doubles are serialized store serialize_precision significant -; digits after the floating point. The default value ensures that when floats -; are decoded with unserialize, the data will remain the same. -serialize_precision = 17 - -; open_basedir, if set, limits all file operations to the defined directory -; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/open-basedir -;open_basedir = - -; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/disable-functions -disable_functions = - -; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. -; http://php.net/disable-classes -disable_classes = - -; Colors for Syntax Highlighting mode. Anything that's acceptable in -; would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; http://php.net/realpath-cache-size -;realpath_cache_size = 16k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc -zend.enable_gc = On - -; If enabled, scripts may be written in encodings that are incompatible with -; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such -; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off -;zend.multibyte = Off - -; Allows to set the default encoding for the scripts. This value will be used -; unless "declare(encoding=...)" directive appears at the top of the script. -; Only affects if zend.multibyte is set. -; Default: "" -;zend.script_encoding = - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = On - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 30 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 60 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; How many GET/POST/COOKIE input variables may be accepted -; max_input_vars = 1000 - -; Maximum amount of memory a script may consume (128MB) -; http://php.net/memory-limit -memory_limit = 128M - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it's automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL (Show all errors, warnings and notices including coding standards.) -; E_ALL & ~E_NOTICE (Show all errors, except for notices) -; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting -error_reporting = E_ALL - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; It's recommended that errors be logged on production servers rather than -; having the errors sent to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = On - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. But, it's strongly recommended that you -; leave this setting off on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = On - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This has only effect in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/track-errors -track_errors = On - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of formatting the -; error message as HTML for easier reading. This directive controls whether -; the error message is formatted as HTML or not. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: On -; Development Value: On -; Production value: On -; http://php.net/html-errors -html_errors = On - -; If html_errors is set to On *and* docref_root is not empty, then PHP -; produces clickable error messages that direct to a page describing the error -; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty, in which -; case no links to documentation are generated. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -;error_log = php_errors.log -; Log errors to syslog (Event Log on Windows). -;error_log = syslog - -;windows.show_crt_warning -; Default value: 0 -; Development value: 0 -; Production value: 0 - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. G,P,C,E & S are abbreviations for the following respective super -; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty -; paid for the registration of these arrays and because ENV is not as commonly -; used as the others, ENV is not recommended on productions servers. You -; can still get access to the environment variables through getenv() should you -; need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "GPCS" - -; This directive determines which super global data (G,P,C,E & S) should -; be registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive are -; specified in the same manner as the variables_order directive, EXCEPT one. -; Leaving this value empty will cause PHP to use the value set in the -; variables_order directive. It does not mean it will leave the super globals -; array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the ENV, REQUEST and SERVER variables are created when they're -; first used (Just In Time) instead of when the script starts. If these -; variables are not used within a script, having this directive on will result -; in a performance gain. The PHP directive register_argc_argv must be disabled -; for this directive to have any affect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Whether PHP will read the POST data. -; This option is enabled by default. -; Most likely, you won't want to disable this option globally. It causes $_POST -; and $_FILES to always be empty; the only way you will be able to read the -; POST data will be through the php://input stream wrapper. This can be useful -; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading -;enable_post_data_reading = Off - -; Maximum size of POST data that PHP will accept. -; Its value may be 0 to disable the limit. It is ignored if POST data reading -; is disabled through enable_post_data_reading. -; http://php.net/post-max-size -post_max_size = 100M - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a character encoding using -; the Content-type: header. To disable sending of the charset, simply -; set it to be empty. -; -; PHP's built-in default is text/html -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to empty. -; http://php.net/default-charset -;default_charset = "UTF-8" - -; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is -; to disable this feature. If post reading is disabled through -; enable_post_data_reading, $HTTP_RAW_POST_DATA is *NOT* populated. -; http://php.net/always-populate-raw-post-data -;always_populate_raw_post_data = On - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/php/includes" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -; extension_dir = "./" -; On windows: -; extension_dir = "ext" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -;cgi.fix_pathinfo=1 - -; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1 - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If it's set 0 PHP sends Status: header that -; is supported by Apache. When this option is set to 1 PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 100M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename.extension -; -; For example, on Windows: -; -; extension=msql.dll -; -; ... or under UNIX: -; -; extension=msql.so -; -; ... or with a path: -; -; extension=/path/to/extension/msql.so -; -; If you only provide the name of the extension, PHP will look for it in its -; default extension directory. -; -; Windows Extensions -; Note that ODBC support is built in, so no dll is needed for it. -; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) -; extension folders as well as the separate PECL DLL download (PHP 5). -; Be sure to appropriately set the extension_dir directive. -; -;extension=php_bz2.dll -;extension=php_curl.dll -;extension=php_fileinfo.dll -;extension=php_gd2.dll -;extension=php_gettext.dll -;extension=php_gmp.dll -;extension=php_intl.dll -;extension=php_imap.dll -;extension=php_interbase.dll -;extension=php_ldap.dll -;extension=php_mbstring.dll -;extension=php_exif.dll ; Must be after mbstring as it depends on it -;extension=php_mysql.dll -;extension=php_mysqli.dll -;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client -;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client -;extension=php_openssl.dll -;extension=php_pdo_firebird.dll -;extension=php_pdo_mysql.dll -;extension=php_pdo_oci.dll -;extension=php_pdo_odbc.dll -;extension=php_pdo_pgsql.dll -;extension=php_pdo_sqlite.dll -;extension=php_pgsql.dll -;extension=php_pspell.dll -;extension=php_shmop.dll - -; The MIBS data available in the PHP distribution must be installed. -; See http://www.php.net/manual/en/snmp.installation.php -;extension=php_snmp.dll - -;extension=php_soap.dll -;extension=php_sockets.dll -;extension=php_sqlite3.dll -;extension=php_sybase_ct.dll -;extension=php_tidy.dll -;extension=php_xmlrpc.dll -;extension=php_xsl.dll - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[CLI Server] -; Whether the CLI web server uses ANSI color coding in its terminal output. -cli_server.color = On - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -;date.timezone = - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -;iconv.input_encoding = ISO-8859-1 -;iconv.internal_encoding = ISO-8859-1 -;iconv.output_encoding = ISO-8859-1 - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING - -[sqlite] -; http://php.net/sqlite.assoc-case -;sqlite.assoc_case = 0 - -[sqlite3] -;sqlite3.extension_dir = - -[Pcre] -;PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -;PCRE library recursion limit. -;Please note that if you set this value to a high number you may consume all -;the available process stack and eventually crash PHP (due to reaching the -;stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/pdo_mysql.cache_size -pdo_mysql.cache_size = 2000 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/pdo_mysql.default-socket -pdo_mysql.default_socket=/var/lib/mysql/mysql.sock - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(), even in safe mode. -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = On - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = -; Log mail to syslog (Event Log on Windows). -;mail.log = syslog - -[SQL] -; http://php.net/sql.safe-mode -sql.safe_mode = Off - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -;birdstep.max_links = -1 - -[Interbase] -; Allow or prevent persistent links. -ibase.allow_persistent = 1 - -; Maximum number of persistent links. -1 means no limit. -ibase.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -ibase.max_links = -1 - -; Default database name for ibase_connect(). -;ibase.default_db = - -; Default username for ibase_connect(). -;ibase.default_user = - -; Default password for ibase_connect(). -;ibase.default_password = - -; Default charset for ibase_connect(). -;ibase.default_charset = - -; Default timestamp format. -ibase.timestampformat = "%Y-%m-%d %H:%M:%S" - -; Default date format. -ibase.dateformat = "%Y-%m-%d" - -; Default time format. -ibase.timeformat = "%H:%M:%S" - -[MySQL] -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysql.allow_local_infile -mysql.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysql.allow-persistent -mysql.allow_persistent = On - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysql.cache_size -mysql.cache_size = 2000 - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysql.max-persistent -mysql.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/mysql.max-links -mysql.max_links = -1 - -; Default port number for mysql_connect(). If unset, mysql_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysql.default-port -mysql.default_port = - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysql.default-socket -mysql.default_socket =/var/lib/mysql/mysql.sock - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-host -mysql.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-user -mysql.default_user = - -; Default password for mysql_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysql.default-password -mysql.default_password = - -; Maximum time (in seconds) for connect timeout. -1 means no limit -; http://php.net/mysql.connect-timeout -mysql.connect_timeout = 60 - -; Trace mode. When trace_mode is active (=On), warnings for table/index scans and -; SQL-Errors will be displayed. -; http://php.net/mysql.trace-mode -mysql.trace_mode = Off - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysqli.cache_size -mysqli.cache_size = 2000 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket =/var/lib/mysql/mysql.sock - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_statistics -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_memory_statistics -mysqlnd.collect_memory_statistics = On - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -; http://php.net/mysqlnd.net_cmd_buffer_size -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -; http://php.net/mysqlnd.net_read_buffer_size -;mysqlnd.net_read_buffer_size = 32768 - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgreSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[Sybase-CT] -; Allow or prevent persistent links. -; http://php.net/sybct.allow-persistent -sybct.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/sybct.max-persistent -sybct.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/sybct.max-links -sybct.max_links = -1 - -; Minimum server message severity to display. -; http://php.net/sybct.min-server-severity -sybct.min_server_severity = 10 - -; Minimum client message severity to display. -; http://php.net/sybct.min-client-severity -sybct.min_client_severity = 10 - -; Set per-context timeout -; http://php.net/sybct.timeout -;sybct.timeout= - -;sybct.packet_size - -; The maximum time in seconds to wait for a connection attempt to succeed before returning failure. -; Default: one minute -;sybct.login_timeout= - -; The name of the host you claim to be connecting from, for display by sp_who. -; Default: none -;sybct.hostname= - -; Allows you to define how often deadlocks are to be retried. -1 means "forever". -; Default: 0 -;sybct.deadlock_retry_count= - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if you -; or your OS have problems with lots of files in one directory, and is -; a more efficient layout for servers that handle lots of sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/tmp" - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combating -; session hijacking when not specifying and managing your own session id. It is -; not the end all be all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started -; on every session initialization. The probability is calculated by using -; gc_probability/gc_divisor. Where session.gc_probability is the numerator -; and gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 1 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using the following equation: -; gc_probability/gc_divisor. Where session.gc_probability is the numerator and -; session.gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. Increasing this value to 1000 will give you -; a 0.1% chance the gc will run on any give request. For high volume production servers, -; this is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script would is the equivalent of -; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; How many bytes to read from the file. -; http://php.net/session.entropy-length -;session.entropy_length = 32 - -; Specified here to create the session id. -; http://php.net/session.entropy-file -; Defaults to /dev/urandom -; On systems that don't have /dev/urandom but do have /dev/arandom, this will default to /dev/arandom -; If neither are found at compile time, the default is no entropy file. -; On windows, setting the entropy_length setting will activate the -; Windows random source (using the CryptoAPI) -;session.entropy_file = /dev/urandom - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publicly accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Select a hash function for use in generating session ids. -; Possible Values -; 0 (MD5 128 bits) -; 1 (SHA-1 160 bits) -; This option may also be set to the name of any hash function supported by -; the hash extension. A list of available hashes is returned by the hash_algos() -; function. -; http://php.net/session.hash-function -session.hash_function = 0 - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.hash_bits_per_character = 5 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -; form/fieldset are special; if you include them here, the rewriter will -; add a hidden field with the info which is otherwise appended -; to URLs. If you want XHTML conformity, remove the form entry. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; http://php.net/url-rewriter.tags -url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" - -; Enable upload progress tracking in $_SESSION -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.enabled -;session.upload_progress.enabled = On - -; Cleanup the progress information as soon as all POST data has been read -; (i.e. upload completed). -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.cleanup -;session.upload_progress.cleanup = On - -; A prefix used for the upload progress key in $_SESSION -; Default Value: "upload_progress_" -; Development Value: "upload_progress_" -; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix -;session.upload_progress.prefix = "upload_progress_" - -; The index name (concatenated with the prefix) in $_SESSION -; containing the upload progress information -; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name -;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" - -; How frequently the upload progress should be updated. -; Given either in percentages (per-file), or in bytes -; Default Value: "1%" -; Development Value: "1%" -; Production Value: "1%" -; http://php.net/session.upload-progress.freq -;session.upload_progress.freq = "1%" - -; The minimum delay between updates, in seconds -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.upload-progress.min-freq -;session.upload_progress.min_freq = "1" - -[MSSQL] -; Allow or prevent persistent links. -mssql.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -mssql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -mssql.max_links = -1 - -; Minimum error severity to display. -mssql.min_error_severity = 10 - -; Minimum message severity to display. -mssql.min_message_severity = 10 - -; Compatibility mode with old versions of PHP 3.0. -mssql.compatability_mode = Off - -; Connect timeout -;mssql.connect_timeout = 5 - -; Query timeout -;mssql.timeout = 60 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textlimit = 4096 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textsize = 4096 - -; Limits the number of records in each batch. 0 = all records in one batch. -;mssql.batchsize = 0 - -; Specify how datetime and datetim4 columns are returned -; On => Returns data converted to SQL server settings -; Off => Returns values as YYYY-MM-DD hh:mm:ss -;mssql.datetimeconvert = On - -; Use NT authentication when connecting to the server -mssql.secure_connection = Off - -; Specify max number of processes. -1 = library default -; msdlib defaults to 25 -; FreeTDS defaults to 4096 -;mssql.max_procs = -1 - -; Specify client character set. -; If empty or not set the client charset from freetds.conf is used -; This is only used when compiled with FreeTDS -;mssql.charset = "ISO-8859-1" - -[Assertion] -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Issue a PHP warning for each failed assertion. -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a components typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; internal/script encoding. -; Some encoding cannot work as internal encoding. -; (e.g. SJIS, BIG5, ISO-2022-*) -; http://php.net/mbstring.internal-encoding -;mbstring.internal_encoding = EUC-JP - -; http input encoding. -; http://php.net/mbstring.http-input -;mbstring.http_input = auto - -; http output encoding. mb_output_handler must be -; registered as output buffer to function -; http://php.net/mbstring.http-output -;mbstring.http_output = SJIS - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; auto means -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none; - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -;mbstring.strict_detection = Off - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 0 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[mcrypt] -; For more information about mcrypt settings see http://php.net/mcrypt-module-open - -; Directory where to load mcrypt algorithms -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.algorithms_dir= - -; Directory where to load mcrypt modes -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.modes_dir= - -[dba] -;dba.default_handler= - -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - -; Local Variables: -; tab-width: 4 -; End: - -[opcache] -; add OPcache file location -zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/opcache.so - -; Determines if Zend OPCache is enabled -opcache.enable=1 - -; Determines if Zend OPCache is enabled for the CLI version of PHP -opcache.enable_cli=1 - -; The OPcache shared memory storage size -opcache.memory_consumption=256 - -; The amount of memory for interned strings in Mbytes -opcache.interned_strings_buffer=4 - -; The maximum number of keys (scripts) in the OPcache hash table -; Only numbers between 200 and 100000 are allowed -opcache.max_accelerated_files=20000 - -; The maximum percentage of "wasted" memory until a restart is scheduled -;opcache.max_wasted_percentage=5 - -; When this directive is enabled, the OPcache appends the current working -; directory to the script key, thus eliminating possible collisions between -; files with the same name (basename). Disabling the directive improves -; performance, but may break existing applications. -;opcache.use_cwd=1 - -; When disabled, you must reset the OPcache manually or restart the -; webserver for changes to the filesystem to take effect -opcache.validate_timestamps=1 - -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -opcache.revalidate_freq=30 - -; Enables or disables file search in include_path optimization -;opcache.revalidate_path=0 - -; If disabled, all PHPDoc comments are dropped from the code to reduce the -; size of the optimized code. -;opcache.save_comments=1 - -; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments" -; may be always stored (save_comments=1), but not loaded by applications -; that don't need them anyway. -;opcache.load_comments=1 - -; If enabled, a fast shutdown sequence is used for the accelerated code -;opcache.fast_shutdown=0 - -; Allow file existence override (file_exists, etc.) performance feature. -;opcache.enable_file_override=0 - -; A bitmask, where each bit enables or disables the appropriate OPcache -; passes -;opcache.optimization_level=0xffffffff - -;opcache.inherited_hack=1 -;opcache.dups_fix=0 - -; The location of the OPcache blacklist file (wildcards allowed). -; Each OPcache blacklist file is a text file that holds the names of files -; that should not be accelerated. The file format is to add each filename -; to a new line. The filename may be a full path or just a file prefix -; (i.e., /var/www/x blacklists all the files and directories in /var/www -; that start with 'x'). Line starting with a ; are ignored (comments). -;opcache.blacklist_filename= - -; Allows exclusion of large files from being cached. By default all files -; are cached. -;opcache.max_file_size=0 - -; Check the cache checksum each N requests. -; The default value of "0" means that the checks are disabled. -;opcache.consistency_checks=0 - -; How long to wait (in seconds) for a scheduled restart to begin if the cache -; is not being accessed. -; Default was 180 (3 minutes), changed to 1 hour to keep the -; cache from being reset regularly. -opcache.force_restart_timeout=3600 - -; OPcache error_log file name. Empty string assumes "stderr". -; opcache.error_log=/opt/meza/logs/opcache_error.log - -; All OPcache errors go to the Web server log. -; By default, only fatal errors (level 0) or errors (level 1) are logged. -; You can also enable warnings (level 2), info messages (level 3) or -; debug messages (level 4). -;opcache.log_verbosity_level=1 - -; Preferred Shared Memory back-end. Leave empty and let the system decide. -;opcache.preferred_memory_model= - -; Protect the shared memory from unexpected writing during script execution. -; Useful for internal debugging only. -;opcache.protect_memory=0 \ No newline at end of file diff --git a/scripts/php.sh b/scripts/php.sh index 9af92e217..575fdf69f 100644 --- a/scripts/php.sh +++ b/scripts/php.sh @@ -48,7 +48,7 @@ cd "$m_meza/sources/php-$phpversion/" # cmd_profile "START php build" ./configure \ - --with-apxs2=/usr/local/apache2/bin/apxs \ + --with-apxs2=/usr/bin/apxs \ --enable-bcmath \ --with-bz2 \ --enable-calendar \ @@ -82,7 +82,6 @@ cmd_profile "START php build" --enable-inline-optimization \ --enable-mbregex \ --enable-opcache \ - --enable-fpm \ --enable-intl \ --prefix=/usr/local/php make @@ -95,7 +94,7 @@ sudo ln -s /usr/local/php/bin/php /usr/bin/php # # Initiate php.ini # -cp "$m_meza/scripts/php.ini-development" /usr/local/php/lib/php.ini +ln -s "$m_config/core/php.ini" /usr/local/php/lib/php.ini # @@ -105,5 +104,9 @@ chkconfig httpd on service httpd status service httpd restart +# Install PEAR and PEAR Mail +chmod 744 "$m_meza/scripts/install-pear.sh" +"$m_meza/scripts/install-pear.sh" +/usr/local/php/bin/pear install --alldeps Mail echo -e "\n\nPHP has been setup.\n\nPlease use the web browser on your host computer to navigate to http://192.168.56.56/info.php to verify php is being executed." diff --git a/scripts/samba.sh b/scripts/samba.sh index d42ef4b89..7ecb959c4 100644 --- a/scripts/samba.sh +++ b/scripts/samba.sh @@ -8,7 +8,7 @@ # and thus it needs to know how to get to the config.sh script on it's own # DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$DIR/config.sh" +source "/opt/meza/config/core/config.sh" echo "Installing samba" diff --git a/scripts/saml.sh b/scripts/saml.sh index ba93c1bae..62dcd64f8 100644 --- a/scripts/saml.sh +++ b/scripts/saml.sh @@ -20,64 +20,97 @@ fi # and thus it needs to know how to get to the config.sh script on it's own # DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source "$DIR/config.sh" +source "/opt/meza/config/core/config.sh" +if [ -f "$m_config/local/saml-setup-config.sh" ]; then + source "$m_config/local/saml-setup-config.sh" +fi + # # Get admin name # -echo -e "\nType a SAML admin full name and press [ENTER]:" -read saml_admin +if [ -z "$saml_admin" ]; then + echo -e "\nType a SAML admin full name and press [ENTER]:" + read saml_admin +fi # # Get admin password # default_saml_password="1234" -echo -e "\nType a SAML admin password and press [ENTER]:" -read -s saml_password -saml_password=${saml_password:-$default_saml_password} +if [ -z "$saml_password" ]; then + echo -e "\nType a SAML admin password and press [ENTER]:" + read -s saml_password + saml_password=${saml_password:-$default_saml_password} +fi # # Get admin email # -echo -e "\nType a SAML admin e-mail and press [ENTER]:" -read saml_admin_email +if [ -z "$saml_admin_email" ]; then + echo -e "\nType a SAML admin e-mail and press [ENTER]:" + read saml_admin_email +fi # # Setup identity provider and service provider # -echo -e "\nIdentity Provider (IdP) then [ENTER]:" -echo -e "Ex: Probably your identity provider's URL, like https://id.example.com" -read idp_entity_id +if [ -z "$idp_entity_id" ]; then + echo -e "\nIdentity Provider (IdP) then [ENTER]:" + echo -e "Ex: Probably your identity provider's URL, like https://id.example.com" + read idp_entity_id +fi + +if [ -z "$sign_on_url" ]; then + echo -e "\nIdP sign-on URL then [ENTER]:" + read sign_on_url +fi + + +if [ -z "$logout_url" ]; then + echo -e "\nIdP logout URL then [ENTER]:" + read logout_url +fi + +if [ -z "$cert_fingerprint" ]; then + echo -e "\nIdP certificate fingerprint then [ENTER]:" + read cert_fingerprint +fi + -echo -e "\nIdP sign-on URL then [ENTER]:" -read sign_on_url +if [ -z "$sp_entity_id" ]; then + echo -e "\nService Provider (SP) entity ID then [ENTER]:" + echo -e "Ex: Probably your application's URL, like https://myapp.example.com" + read sp_entity_id +fi -echo -e "\nIdP logout URL then [ENTER]:" -read logout_url +if [ -z "$name_id_policy" ]; then + echo -e "\nName-ID Policy then [ENTER]:" + echo -e "Ex: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" + read name_id_policy +fi -echo -e "\nIdP certificate fingerprint then [ENTER]:" -read cert_fingerprint -echo -e "\nService Provider (SP) entity ID then [ENTER]:" -echo -e "Ex: Probably your application's URL, like https://myapp.example.com" -read sp_entity_id +if [ -z "$username_attr" ]; then + echo -e "\nSAML attribute name to map to MediaWiki username then [ENTER]:" + read username_attr +fi -echo -e "\nName-ID Policy then [ENTER]:" -echo -e "Ex: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" -read name_id_policy -echo -e "\nSAML attribute name to map to MediaWiki username then [ENTER]:" -read username_attr +if [ -z "$realname_attr" ]; then + echo -e "\nSAML attribute name to map to MediaWiki realname then [ENTER]:" + read realname_attr +fi -echo -e "\nSAML attribute name to map to MediaWiki realname then [ENTER]:" -read realname_attr -echo -e "\nSAML attribute name to map to MediaWiki e-mail then [ENTER]:" -read email_attr +if [ -z "$email_attr" ]; then + echo -e "\nSAML attribute name to map to MediaWiki e-mail then [ENTER]:" + read email_attr +fi # Escape values of inputs which could have disallowed characters: / \ & @@ -124,7 +157,8 @@ sed -r -i "s/'technicalcontact_email'.*$/'technicalcontact_email' => '$saml_admi # This inserts the contents of one file (saml_httpd.conf) below a marker # in httpd.conf. See link below for more info: # http://unix.stackexchange.com/questions/32908/how-to-insert-the-content-of-a-file-into-another-file-before-a-pattern-marker -sed -i -e "/ADD SPECIAL CONFIG BELOW/r $m_meza/scripts/config/SAML/saml_httpd.conf" "$m_apache/conf/httpd.conf" +# FIXME: httpd.conf should not be modified +sed -i -e "/ADD SPECIAL CONFIG BELOW/r $m_config/template/saml_httpd.conf" "$m_config/core/httpd.conf" # restart apache service httpd restart @@ -132,9 +166,11 @@ service httpd restart # Setup identity provider (IdP) for SimpleSamlPHP cd "$m_meza/simplesamlphp/metadata" rm ./saml20-idp-remote.php -cp "$m_meza/scripts/config/SAML/saml20-idp-remote.php" ./saml20-idp-remote.php +cp "$m_config/template/saml20-idp-remote.php" "$m_config/local/saml20-idp-remote.php" +ln -s "$m_config/local/saml20-idp-remote.php" "$m_meza/simplesamlphp/metadata/saml20-idp-remote.php" # input correct values for your IdP +cd "$m_config/local" sed -r -i "s/idp_entity_id/$idp_entity_id/g;" ./saml20-idp-remote.php sed -r -i "s/sign_on_url/$sign_on_url/g;" ./saml20-idp-remote.php sed -r -i "s/logout_url/$logout_url/g;" ./saml20-idp-remote.php @@ -142,9 +178,11 @@ sed -r -i "s/cert_fingerprint/$cert_fingerprint/g;" ./saml20-idp-remote.php # Setup authsources.php -cd ../config -sed -r -i "s/'entityID' => null,/'entityID' => '$sp_entity_id',\n\t'NameIDPolicy' => '$name_id_policy',\n/g;" ./authsources.php -sed -r -i "s/'idp' => null,/'idp' => '$idp_entity_id',/g;" ./authsources.php +cd "$m_config/local" +mv "$m_meza/simplesamlphp/config/authsources.php" ./simplesaml_authsources.php +sed -r -i "s/'entityID' => null,/'entityID' => '$sp_entity_id',\n\t'NameIDPolicy' => '$name_id_policy',\n/g;" ./simplesaml_authsources.php +sed -r -i "s/'idp' => null,/'idp' => '$idp_entity_id',/g;" ./simplesaml_authsources.php +ln -s "$m_config/local/simplesaml_authsources.php" "$m_meza/simplesamlphp/config/authsources.php" echo -e "\n" @@ -156,24 +194,31 @@ echo -e "\n" cd "$m_mediawiki/extensions" git clone https://github.com/jornane/mwSimpleSamlAuth.git SimpleSamlAuth -b v0.6 -# Clone Extension:AccessDenied -# Same applies here about loading with ExtensionLoader -git clone https://github.com/jamesmontalvo3/AccessDenied - # Add Exension:SimpleSamlAuth lines to LocalSettings.php (@todo should this be # added to some non-LocalSettings.php file? Something like deltas.php) # # First: make temporary file -cp "$m_meza/scripts/config/SAML/SAML-LocalSettings-Additions.php" ~/SAML-LocalSettings-Additions.php +cp "$m_config/template/SAML-postLocalSettings.php" ~/SAML-postLocalSettings.php # Replace attributes with user input -sed -r -i "s/username_attr/$username_attr/g;" ~/SAML-LocalSettings-Additions.php -sed -r -i "s/realname_attr/$realname_attr/g;" ~/SAML-LocalSettings-Additions.php -sed -r -i "s/email_attr/$email_attr/g;" ~/SAML-LocalSettings-Additions.php +sed -r -i "s/username_attr/$username_attr/g;" ~/SAML-postLocalSettings.php +sed -r -i "s/realname_attr/$realname_attr/g;" ~/SAML-postLocalSettings.php +sed -r -i "s/email_attr/$email_attr/g;" ~/SAML-postLocalSettings.php + +# Add these lines to the bottom of postLocalSettings_allWikis.php, then remove the temp file +if [ ! -f "$m_config/local/postLocalSettings_allWikis.php" ]; then + echo -e " "$m_config/local/postLocalSettings_allWikis.php" +fi +cat ~/SAML-postLocalSettings.php >> "$m_config/local/postLocalSettings_allWikis.php"; +rm ~/SAML-postLocalSettings.php + -# Add these lines to the bottom of LocalSettings.php, then remove the temp file -cat ~/SAML-LocalSettings-Additions.php >> "$m_mediawiki/LocalSettings.php"; -rm ~/SAML-LocalSettings-Additions.php +# Add these lines to the bottom of preLocalSettings_allWikis.php, then remove the temp file +# these disable account creation for users +if [ ! -f "$m_config/local/preLocalSettings_allWikis.php" ]; then + echo -e " "$m_config/local/preLocalSettings_allWikis.php" +fi +cat "$m_config/template/SAML-preLocalSettings.php" >> "$m_config/local/preLocalSettings_allWikis.php"; echo "Complete with SAML setup" diff --git a/scripts/slack.sh b/scripts/slack.sh new file mode 100644 index 000000000..4b2cd8e92 --- /dev/null +++ b/scripts/slack.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Send a message to Slack + +slackwebhook="$1" +title="$2" +text="$3" + +# Announce on Slack if a slack webhook provided +if [[ ! -z "$slackwebhook" ]]; then + + if [[ "$slackwebhook" = "n" ]]; then + exit; + fi + + if [[ ! -z "$title$text" ]]; then + primary="$title" + secondary="$text" + elif [[ ! -z "$title" ]]; then + primary="$title" + elif [[ ! -z "$text" ]]; then + primary="$text" + else + echo "no payload for webhook. exiting." + exit 1; + fi + + # removed from json: \"text\": \"Your meza installation is complete\" + + + escapedPrimary=$(echo $title | sed 's/"/\"/g' | sed "s/'/\'/g" ) + + + + if [[ ! -z "$secondary" ]]; then + escapedSecondary=$(echo "$secondary" | sed 's/"/\"/g' | sed "s/'/\'/g" ) + fields="\"title\": \"$escapedPrimary\" ,\"value\": \"$escapedSecondary\"" + else + fields="\"value\": \"$escapedPrimary\"" + fi + + json="{ + \"attachments\": [ + { + \"color\": \"#339966\", + \"fallback\": \"$escapedPrimary\", + \"fields\": [ + { + \"short\": false, + $fields + } + ] + } + ] + }" + + curl -s -d "payload=$json" "$slackwebhook" + echo + echo + echo "Message sent to Slack webhook $slackwebhook" + +fi \ No newline at end of file diff --git a/scripts/unifyUserTables.php b/scripts/unifyUserTables.php new file mode 100644 index 000000000..c7e5aa7e0 --- /dev/null +++ b/scripts/unifyUserTables.php @@ -0,0 +1,830 @@ + array( + "unique" => "pr_id", + "idField" => "pr_user" + ), + "protected_titles" => array( + "unique" => array("pt_namespace","pt_title"), + "idField" => "pt_user" + ), + "uploadstash" => array( + "unique" => "us_id", + "idField" => "us_user" + ), + "user_former_groups" => array( + "unique" => array("unique_username" => "user.user_name","ufg_group"), // unique replace ufg_user + "idField" => "ufg_user" + ), + "user_groups" => array( + "unique" => array("unique_username" => "user.user_name", "ug_group"), // unique replace ug_user + "idField" => "ug_user" + ), + "user_newtalk" => array( + "unique" => array("unique_username" => "user.user_name","user_ip"), // unique replace user_id + "idField" => "user_id" + ), + "watchlist" => array( + "unique" => array("unique_username" => "user.user_name","wl_namespace","wl_title"), // unique replace wl_user + "idField" => "wl_user" + ), + + + // these have IDs and usernames, but usernames should not need to be modified or used + "archive" => array( + "unique" => "ar_id", + "idField" => "ar_user", + "userNameField" => "ar_user_text" + ), + "filearchive" => array( + "unique" => "fa_id", + "idField" => "fa_user", + "userNameField" => "fa_user_text" + ), + "image" => array( + "unique" => "img_name", + "idField" => "img_user", + "userNameField" => "img_user_text" + ), + "logging" => array( + "unique" => "log_id", + "idField" => "log_user", + "userNameField" => "log_user_text" + ), + "oldimage" => array( + // tried oi_sha1 (not unique) and oi_archive_name (sometimes blank) + "unique" => array('oi_name','oi_timestamp'), + "idField" => "oi_user", + "userNameField" => "oi_user_text" + ), + "recentchanges" => array( + "unique" => "rc_id", + "idField" => "rc_user", + "userNameField" => "rc_user_text" + ), + "revision" => array( + "unique" => "rev_id", + "idField" => "rev_user", + "userNameField" => "rev_user_text" + ), + + + // extension tables + 'watch_tracking_user' => array( + "unique" => array("tracking_timestamp", "unique_username" => "user.user_name"), // unique replace user_id + "idField" => 'user_id' + ), + + ); + + + public $successes = 0; + public $failures = 0; + public $totalChecks = 0; + + public $userTable = array( "idField" => "user_id", "userNameField" => "user_name" ); + public $userPropsTable = array( + "unique" => array("up_user", "up_property"), + "idField" => "up_user" + ); + + public $userTableRows = false; + + // If you have a wiki with more than a million users, pay me to update this + public $initialOffset = 1000000; + + public $userArray = array(); + public $newUserProps = array(); + + + public function __construct() { + parent::__construct(); + + $this->mDescription = "This combines all user tables into one. This is potentially very destructive. Make a backup first."; + + // addOption ($name, $description, $required=false, $withArg=false, $shortName=false) + $this->addOption( + 'prime-wiki', + 'Wiki ID of prime wiki', + true, true ); + + $this->recordTables = $this->tablesToModify; // can't add user_properties, since it gets moved to primewiki + + } + + + public function execute() { + + // Perform checks to make sure ready for unification + $this->checkSetup(); + + // ??? + $this->getWikiIDs(); + + // make array of all wiki database names + connection configs, including prime wiki + $this->getWikiDatabaseConfigs(); + + // actually get array of database connection objects + $this->getWikiDBs(); + + // ??? + $this->originalUserIDs = $this->getUserIDsByWiki(); + + // Record relevant info from all tables for checking later + $this->recordOriginalIDs(); + + // Add $this->initialOffset to all user IDs on all tables on all wikis + // and delete an unneeded table. Read new IDS into $this->tempUserIDs + $this->prepDatabases(); + + // ??? + $this->temporaryUserIDs = $this->getUserIDsByWiki(); + + // Create $this->userArray by reading table `user` from all databases + // From this array comes the new user IDs for all users + $this->createUserArray(); + + // Update all tables of all wikis with the new user IDs from $this->userArray + // including primeWiki. Delete user and user_properties tables of all except + // primeWiki. + $this->performTableModification(); + + // ??? + $this->createUnifiedUserTable(); + + // ??? + $this->createUnifiedUserPropertiesTable(); + + // Run tests against data recorded prior to ID changes + $this->testNewIDs(); + + // ??? + $this->closeout(); + + } + + public function checkSetup () { + + global $m_htdocs, $m_config, $m_meza; + + if ( is_file( "$m_config/local/primewiki" ) ) { + die( "A prime wiki is already set in $m_config/local/primewiki. You cannot run this script." ); + } + + // prime wiki ID and database name + $this->primeWiki = trim( $this->getOption( "prime-wiki" ) ); + + $this->recordDir = "$m_meza/logs/user-unify-" . date( "YmdHis" ); + + } + + public function getWikiIDs () { + global $m_htdocs; + + // all other wiki IDs + $wikisDirectory = array_slice( scandir( "$m_htdocs/wikis" ), 2 ); + $this->wikiIDs = array(); + foreach( $wikisDirectory as $fileOrDir ) { + if ( is_dir( "$m_htdocs/wikis/$fileOrDir" ) ) { + $this->wikiIDs[] = $fileOrDir; + } + } + + return $this->wikiIDs; + + } + + public function getWikiDatabaseConfigs () { + $this->wikiDatabaseConfigs = array( + $this->primeWiki => $this->getWikiDbConfig( $this->primeWiki ) + ); + foreach ( $this->wikiIDs as $wikiID ) { + if ( $wikiID == $this->primeWiki ) { + continue; + } + $this->wikiDatabaseConfigs[$wikiID] = $this->getWikiDbConfig( $wikiID ); + } + return $this->wikiDatabaseConfigs; + } + + public function getWikiDBs () { + + $this->wikiDBs = array(); + $this->originalUserIDs = array(); + global $wgDBtype, $wgDBserver; + foreach( $this->wikiDatabaseConfigs as $wikiID => $conn ) { + $this->output( "\nConnecting to database $wikiID"); + // $this->wikiDBs[$wiki] = new DB( $wiki ); + + $this->wikiDBs[$wikiID] = DatabaseBase::factory( + $wgDBtype, + array( + 'host' => $wgDBserver, + 'user' => $conn['user'], + 'password' => $conn['password'], + 'dbname' => $conn['database'], + 'driver' => 'mysqli', + // 'flags' => , // meza does not currently use this + // 'tablePrefix' => , // meza does not currently use this + // 'schema' => , // I think this is only required for MS SQL + ) + ); + + } + + } + + public function getUserIDsByWiki () { + + $usersByWiki = array(); + + foreach ( $this->wikiDBs as $wikiID => $db ) { + + $thisWikiUserTable = $db->query( "SELECT user_id, user_name FROM user" ); + + $usersByWiki[$wikiID] = array(); + while( $row = $thisWikiUserTable->fetchRow() ) { + $userName = $row['user_name']; + $userID = $row['user_id']; + + $usersByWiki[$wikiID][$userName] = $userID; + } + + } + + return $usersByWiki; + } + + + /** + * For each database, record each tables unique identifier, initial id, + * and initial username + * + **/ + public function recordOriginalIDs () { + + // don't love this + mkdir( $this->recordDir ); + + $recordTables = $this->recordTables; + + foreach( $this->wikiDBs as $wikiID => $db ) { + + $this->output( "\n#\n# Recording original info for $wikiID\n#" ); + + foreach ( $recordTables as $tableName => $tableInfo ) { + + list( $result, $uniqueFields ) = $this->getRecordSelect( $wikiID, $tableName, false ); + + $filetext = ''; + $uniques = array(); + while( $row = $result->fetchRow() ) { + $uniqueString = $this->getUniqueFieldString( $uniqueFields, $row ); + $filetext .= $uniqueString . "\t" . $row['user_id_number'] . "\t" . $row['user_name_text'] . "\n"; + } + file_put_contents( "{$this->recordDir}/$wikiID.$tableName", $filetext ); + + } + + // FIXME: This doesn't run a test against the ipblock table because it's a unique case + // and it was difficult to implement and not relevant to the developer who had + // no rows in his ipblocks table + + } + } + + // perform database select for recording the pre-modification state + // which is also used for testing the modifications after the fact + // + // NOTE: WE ALWAYS SELECT the username from the user table to make + // sure we're actually seeing that the user ID is being updated + // properly + public function getRecordSelect ( $wikiID, $tableName, $usePrimeWiki ) { + + if ( $usePrimeWiki ) { + $userTableWiki = $this->primeWiki; + } + else { + $userTableWiki = $wikiID; + } + + $userTableWikiDB = $this->getWikiDbConfig( $userTableWiki ); + $userTableWikiDB = $userTableWikiDB['database']; + + + $tableInfo = $this->recordTables[$tableName]; + + $idField = $tableInfo['idField']; + if ( is_array( $tableInfo['unique'] ) ) { + $uniqueFields = $tableInfo['unique']; + } + else { + $uniqueFields = array( $tableInfo['unique'] ); + } + + $selectTables = array( + "t" => $tableName, + "u" => "$userTableWikiDB.user" + ); + $selectFields = array( + 'user_id_number' => "t.$idField", + 'user_name_text' => 'u.user_name' + ); + + foreach( $uniqueFields as $key => $field ) { + + // is numeric: field is like `pr_id` + // else: "unique_username" => "user.user_name" + if ( is_numeric( $key ) ) { + $selectFields[$field] = "t.$field"; + } + else { + $selectFields[$key] = "u.user_name"; + } + } + + $result = $this->wikiDBs[$wikiID]->select( + $selectTables, + $selectFields, + array( + "t.$idField != 0", + "t.$idField IS NOT NULL" + ), + __METHOD__, + null, + array( + 'u' => array( + 'LEFT JOIN', "u.user_id=t.$idField" + ) + ) + ); + + return array( $result, $uniqueFields ); + + } + + // some uniqu + public function getUniqueFieldString ( $uniqueFields, $row ) { + foreach( $uniqueFields as $key => $field ) { + if ( is_numeric( $key ) ) { + $uniques[] = $row[$field]; + } + else { + $uniques[] = $row[$key]; + } + } + return implode( ',', $uniques ); + } + + /** + * For each database, add $this->initialOffset to all user IDs in all tables + * + * This just makes it so user IDs are always unique + * + * Also remove unneeded table + * + **/ + public function prepDatabases () { + foreach( $this->wikiDBs as $wikiID => $db ) { + + $this->output( "\n#\n# Adding initial offset to user IDs in $wikiID\n#" ); + + $prepTables = $this->tablesToModify + + array( "user" => $this->userTable ) + + array( "user_properties" => $this->userPropsTable ); + + foreach ( $prepTables as $tableName => $tableInfo ) { + $idField = $tableInfo['idField']; + $db->query( "UPDATE $tableName SET $idField = $idField + $this->initialOffset WHERE $idField != 0 AND $idField IS NOT NULL" ); + } + + $db->query( "UPDATE ipblocks SET ipb_user = ipb_user + $this->initialOffset WHERE ipb_user != 0 AND ipb_user IS NOT NULL"); + $db->query( "UPDATE ipblocks SET ipb_by = ipb_by + $this->initialOffset WHERE ipb_by != 0 AND ipb_by IS NOT NULL"); + + // DROP external_user table. See https://www.mediawiki.org/wiki/Manual:External_user_table + $db->query( "DROP TABLE IF EXISTS external_user" ); + + } + } + + + /** + * Create $this->userArray by reading table `user` from all databases + * + * + * + **/ + public function createUserArray () { + $userColumnsIssetChecks = array( + 'user_email', + 'user_real_name', + 'user_password' + ); + + $this->output( "\nCreating userArray from all user tables" ); + + // Read user table for all wikis, add to $this->userArray giving each username a new unique ID + foreach( $this->wikiDBs as $wikiID => $db ) { + + $this->output( "\nAdding $wikiID to userArray" ); + + // SELECT entire user table + $result = $db->query( + "SELECT * FROM user" + ); + + while( $row = $result->fetchRow() ) { + + if ( ! $this->userTableRows ) { + $this->userTableRows = array(); + foreach( $row as $key => $value ) { + $this->userTableRows[] = $key; + } + } + + $userName = $row['user_name']; + + if ( ! isset( $this->userArray[$userName] ) ) { + + $this->userArray[$userName] = $row; + + // give new ID + $newId = count( $this->userArray ); + + $this->userArray[$userName]["user_id"] = $newId; + + } else { + + // sum edit counts + $this->userArray[$userName]["user_editcount"] += $row['user_editcount']; + + // If this wiki ($row) has an older user_registration, use this wiki's value + if ( $this->userArray[$userName]["user_registration"] > $row['user_registration'] ) { + $this->userArray[$userName]["user_registration"] = $row['user_registration']; + } + + // If this wiki ($row) has been touched more recently, use this wiki's value + if ( $this->userArray[$userName]["user_touched"] < $row['user_touched'] ) { + $this->userArray[$userName]["user_touched"] = $row['user_touched']; + + // also use this wikis password since they've accessed it more recently + if ( $row['user_password'] ) { + $this->userArray[$userName]["user_password"] = $row['user_password']; + } + } + + foreach ( $userColumnsIssetChecks as $col ) { + if ( ! $this->userArray[$userName][$col] && $row[$col] ) { + $this->userArray[$userName][$col] = $row[$col]; + } + } + + } + } + + } + + } + + + /** + * For all wikis, make changes to tables with usernames and user IDs + * + * Loop through the ~17 tables with usernames and user IDs (except the user + * and user_properties tables) and update them accordingly + * + * In the end, only one user and user_properties table will exist across all + * wikis. + * + **/ + public function performTableModification () { + + $this->output( "\n#\n# Starting major table modifications\n#"); + foreach ( $this->wikiDBs as $wikiID => $db ) { + + $this->output( "\n# Starting major modifications to $wikiID"); + + // // For tables with username and id columns: replace the id with the id from $this->userArray + // foreach( $this->userArray as $userName => $newUserId ) { + // foreach( $tablesWithUsernameAndId as $tableName => $tableInfo ) { + // $idField = $tableInfo['idField']; + // $userNameField = $tableInfo['userNameField']; + + // $stmt = $db->mysqli->prepare( "UPDATE $tableName SET $idField=? WHERE $userNameField=?" ); + // $stmt->bind_param( 'is', $newUserId, $userName ); + // $stmt->execute(); + // } + // } + + // Lookup the ID in the user table, use username to get new ID from $this->userArray, update ID + // $this->originalUserIDs[$wikiID][$userName] = old user id + // $thisWikiUserTable = $db->query( "SELECT user_id, user_name FROM user" ); + // print_r( $thisWikiUserTable ); + + // $usernameToOldId = array(); + $newIdToOld = array(); // array like $newIdToOld[ newId ] = oldId + $tempToNew = array(); // opposite of above... + + // foreach( $thisWikiUserTable as $row ) { + foreach( $this->temporaryUserIDs[$wikiID] as $userName => $tempUserID ) { + + $newUserId = $this->userArray[$userName]['user_id']; + + // quick convert-from-this-to-that arrays + // $usernameToOldId[$userName] = $tempUserID; + // $newIdToOld[$newUserId] = $tempUserID; + $tempToNew[$tempUserID] = $newUserId; + + + foreach( $this->tablesToModify as $tableName => $tableInfo ) { + $idField = $tableInfo['idField']; + + $db->update( + $tableName, + array( $idField => $newUserId ), // set values + array( $idField => $tempUserID ), // conditions: set this where ID field = old value + __METHOD__ + ); + + } + + // fix ipblocks table + $db->update( + 'ipblocks', + array( 'ipb_user' => $newUserId ), + array( 'ipb_user' => $tempUserID ), + __METHOD__ + ); + $db->update( + 'ipblocks', + array( 'ipb_by' => $newUserId ), + array( 'ipb_by' => $tempUserID ), + __METHOD__ + ); + } + + + // Get contents of user_properties, prep for insert into common + // user_properties table + $oldUserProps = $db->query( "SELECT * FROM user_properties" ); + // $this->output( "\n\nOLDUSERPROPS:\n"); + // print_r( $oldUserProps ); + // $this->output( "\n\tempToNew:\n"); + // print_r( $tempToNew ); + + while( $row = $oldUserProps->fetchRow() ) { + if ( isset( $tempToNew[ $row['up_user'] ] ) ) { + $newPropUserId = $tempToNew[ $row['up_user'] ]; + + $row['up_user'] = $newPropUserId; // could be dupes across wikis...need to upsert at end + $this->newUserProps[] = $row; + } else { + $oldId = $row['up_user']; + $this->output( "\nUser ID #$oldId not found in tempToNew array for $wikiID." ); + //$this->output( print_r( array( "id" => $row['up_user'], "array" => $tempToNew ), true ) ); + } + } + + // Empty the user table for this wiki, since it will just use the common + // one created at the end. Same for user_properties + $db->query( "DELETE FROM user" ); + $db->query( "DELETE FROM user_properties" ); + + $this->output( "\n# Complete with major modifications to $wikiID" ); + + } + + $this->output( "\n# Complete with major modifications to all wikis\n" ); + + } + + /** + * Create new user table on the one wiki with the shared user table + * + * + * + **/ + public function createUnifiedUserTable () { + + $this->output( "\n# Creating unified user table. \n" ); + + $this->userArrayForInsert = array(); + while( $row = array_pop( $this->userArray ) ) { + + $i = count( $this->userArrayForInsert ); + foreach( $this->userTableRows as $key ) { + + // if $key doesn't start with "user_" then skip it (it's not a valid field name) + if ( strpos( $key, "user_" ) !== 0 ) { + continue; + } + + $this->userArrayForInsert[$i][$key] = $row[$key]; + } + + } + + $db = $this->wikiDBs[$this->primeWiki]; + $db->query( 'DELETE FROM user' ); + $db->insert( + 'user', + $this->userArrayForInsert, + __METHOD__ + ); + $autoInc = count( $this->userArrayForInsert ) + 1; + $db->query( "ALTER TABLE user AUTO_INCREMENT = $autoInc;" ); + + } + + + /** + * Create new user_properties table on the one wiki with the shared user table + * + * + * + **/ + public function createUnifiedUserPropertiesTable () { + + $this->output( "\n# Creating unified user_properties table. \n" ); + + $this->newUserPropsForInsert = array(); + while( $row = array_pop( $this->newUserProps ) ) { + $this->newUserPropsForInsert[] = array( + 'up_user' => $row['up_user'], + 'up_property' => $row['up_property'], + 'up_value' => $row['up_value'], + ); + } + + $db = $this->wikiDBs[$this->primeWiki]; + $db->query( 'DELETE FROM user_properties' ); + $db->insert( + 'user_properties', + $this->newUserPropsForInsert, + __METHOD__, + array( 'IGNORE' ) // IGNORE or ON DUPLICATE KEY UPDATE ??? + ); + + } + + public function testNewIDs () { + + $this->output( "\nPerforming tests" ); + + $recordFiles = scandir( $this->recordDir ); + $logFileSuccess = ''; + $logFileFailure = ''; + foreach ( $recordFiles as $filename ) { + $filepath = $this->recordDir . "/$filename"; + if ( ! is_file( $filepath ) ) { + continue; + } + + $source = explode( '.', $filename ); + $wikiID = $source[0]; + $tableName = $source[1]; + + // user_name_text, original_id, some number of unique fields + list( $result, $uniqueFields ) = $this->getRecordSelect( $wikiID, $tableName, true ); + + $tester = array(); + while( $row = $result->fetchRow() ) { + $uniqueString = $this->getUniqueFieldString( $uniqueFields, $row ); + $tester[$uniqueString] = array( + 'new_user_name' => $row['user_name_text'], + 'new_user_id' => $row['user_id_number'] + ); + } + unset( $result ); + + // loop through all previously recorded rows + $records = explode("\n", file_get_contents( $filepath ) ); + foreach ( $records as $record ) { + if ( trim( $record ) == "" ) { + continue; + } + $parts = explode( "\t", $record ); + $unique = $parts[0]; + $originalID = $parts[1]; + $originalUserText = trim( $parts[2] ); + + $newUserText = trim( $tester[$unique]['new_user_name'] ); + $newUserID = $tester[$unique]['new_user_id']; + + // check original user not empty, and original user name matches new + if ( $originalUserText && $originalUserText === $newUserText ) { + $success = true; + $successMsg = "[SUCCESS]"; + $this->successes++; + } + else { + $success = false; + $successMsg = "[FAILURE]"; + $this->failures++; + } + $this->totalChecks++; + + $logLine = "$successMsg [$wikiID.$tableName.$unique] [IDs: $originalID --> $newUserID] [Names: $originalUserText --> $newUserText]"; + if ( $success ) { + $logFileSuccess .= $logLine . "\n"; + } + else { + $logFileFailure .= $logLine . "\n"; + } + //$this->output( "\n$logLine" ); + } + + $s = $this->successes; + $f = $this->failures; + $t = $this->totalChecks; + $this->output( "\nComplete test '$filename'; totals = $s success, $f failures, $t tests so far" ); + file_put_contents( $this->recordDir . '/success.log' , $logFileSuccess, FILE_APPEND ); + file_put_contents( $this->recordDir . '/failure.log' , $logFileFailure, FILE_APPEND ); + + $logFileSuccess = ''; + $logFileFailure = ''; + + } + $s = $this->successes; + $f = $this->failures; + $t = $this->totalChecks; + $this->output( "\n\nTESTING COMPLETE! $s success and $f failures of $t total tests" ); + + } + + public function closeout () { + global $m_htdocs, $m_config; + + // Declare the prime-wiki as prime! Write prime wiki's wiki ID to file + if ( file_put_contents( "$m_config/local/primewiki", $this->primeWiki ) ) { + $this->output( "\n# Primewiki written to $m_config/local/primewiki\n" ); + } + else { + $this->output( "\n# Primewiki not written to $m_config/local/primewiki" ); + } + + // Victory! + $this->output( "\n#\n# User table unification COMPLETE!\n#\n" ); + + } + + + // FIXME this belongs in a "Extension:meza" or something + // this very closely duplicates LocalSettings.php prime wiki check + protected function getWikiDbConfig ( $wikiID ) { + + global $m_htdocs, $wgDBuser, $wgDBpassword; + + include "$m_htdocs/wikis/$wikiID/config/preLocalSettings.php"; + + if ( isset( $mezaCustomDBname ) ) { + $wikiDBname = $mezaCustomDBname; + } else { + $wikiDBname = "wiki_$wikiID"; + } + + $wikiDBuser = isset( $mezaCustomDBuser ) ? $mezaCustomDBuser : $wgDBuser; + $wikiDBpass = isset( $mezaCustomDBpass ) ? $mezaCustomDBpass : $wgDBpassword; + + return array( + 'id' => $wikiID, + 'database' => $wikiDBname, + 'user' => $wikiDBuser, + 'password' => $wikiDBpass + ); + + } + +} +$maintClass = "MezaUnifyUserTables"; +require_once( DO_MAINTENANCE ); diff --git a/scripts/yums.sh b/scripts/yums.sh index 2e4e98001..5a826aaf2 100644 --- a/scripts/yums.sh +++ b/scripts/yums.sh @@ -128,6 +128,16 @@ yum install -y \ libmcrypt-devel \ pam-devel \ cifs-utils \ + httpd-devel \ + mod_ssl \ + mod_proxy_html \ + net-tools \ + vim \ + sendmail \ + sendmail-cf \ + m4 \ + expect \ + expectk \ ghostscript cmd_profile "END yum install dependency list" diff --git a/wiki-init/config/disableSearchUpdate.php b/wiki-init/config/disableSearchUpdate.php deleted file mode 100644 index 35a04f413..000000000 --- a/wiki-init/config/disableSearchUpdate.php +++ /dev/null @@ -1,4 +0,0 @@ -