initial commit of file from CVS for smeserver-wordpress on Sat Sep 7 21:15:59 AEST 2024
This commit is contained in:
1
root/etc/e-smith/db/accounts/defaults/wordpress/type
Normal file
1
root/etc/e-smith/db/accounts/defaults/wordpress/type
Normal file
@@ -0,0 +1 @@
|
||||
reserved
|
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
wordpress
|
@@ -0,0 +1 @@
|
||||
wordpress
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
Wordpress weblog
|
@@ -0,0 +1 @@
|
||||
global
|
@@ -0,0 +1 @@
|
||||
disabled
|
@@ -0,0 +1 @@
|
||||
en
|
@@ -0,0 +1 @@
|
||||
enabled
|
10
root/etc/e-smith/db/configuration/migrate/80wordpress
Normal file
10
root/etc/e-smith/db/configuration/migrate/80wordpress
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
use MIME::Base64 qw(encode_base64);
|
||||
|
||||
my $rec = $DB->get('wordpress') || $DB->new_record('wordpress', {type => 'service'});
|
||||
|
||||
my $pw = $rec->prop('DbPassword');
|
||||
return "" if $pw;
|
||||
|
||||
$rec->set_prop('DbPassword', sprintf("%15.0f", int( (1000000000000000) * rand() )));
|
||||
}
|
5
root/etc/e-smith/events/actions/wordpress
Normal file
5
root/etc/e-smith/events/actions/wordpress
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
system('chown www:root -R /usr/share/wordpress');
|
||||
system('chown www:root /etc/wordpress');
|
||||
|
104
root/etc/e-smith/events/actions/wordpress-install.sh
Normal file
104
root/etc/e-smith/events/actions/wordpress-install.sh
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
# Script Name: WordPress Install Shell Script for SME10 https://koozali.com
|
||||
# Brian Read brianr@bjsystems.co.uk March 2021
|
||||
|
||||
# Based on:
|
||||
# Script URI: http://www.redbridgenet.com/wordpress/wordpress-upgrade-shell-script/
|
||||
# Description: Upgrades your WordPress installation following more closely the WordPress guidelines.
|
||||
# Version: 1.0.0
|
||||
# Author: Ed Reckers
|
||||
# Author URI: http://www.redbridgenet.com/
|
||||
# License: GPL2
|
||||
#
|
||||
# Usage ./upgrade.wordpress.sh
|
||||
#
|
||||
# Linux bin paths
|
||||
MYSQLDUMP="$(which mysqldump)"
|
||||
TAR="$(which tar)"
|
||||
GZIP="$(which gzip)"
|
||||
WGET="$(which wget)"
|
||||
UNZIP="$(which unzip)"
|
||||
CP="$(which cp)"
|
||||
RM="$(which rm)"
|
||||
CD="$(which cd)"
|
||||
MKDIR="$(which mkdir)"
|
||||
CHOWN="$(which chown)"
|
||||
|
||||
# Set mysql account credentials
|
||||
MyNAME=$(db configuration getprop wordpress DbName)
|
||||
MyUSER=$(db configuration getprop wordpress DbUser)
|
||||
MyPASS=$(db configuration getprop wordpress DbPassword)
|
||||
MyHOST="localhost"
|
||||
|
||||
#Temp working area
|
||||
TEMPDIR=$(mktemp -d)
|
||||
|
||||
# Directory containing your wordpress installation
|
||||
WEBROOT="/usr/share/wordpress/"
|
||||
|
||||
# Get a sortable date like 2011-01-01 for full backups
|
||||
FULLDATE="$(date +"%Y-%m-%d")"
|
||||
|
||||
# Create progress dots function
|
||||
show_dots() {
|
||||
while ps $1 >/dev/null ; do
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
#Place to find the latest WordPress
|
||||
LATEST_WP="latest.zip"
|
||||
URL_FOR_WP_DOWNLOAD="http://wordpress.org/"$LATEST_WP
|
||||
|
||||
# Check if Wordpress already here, if so exit
|
||||
$MKDIR -p $WEBROOT
|
||||
$CD $WEBROOT
|
||||
if [[ -d wp-admin && -d wp-includes && -d wp-content ]]; then
|
||||
echo "Found WordPress in $WEBROOT - exiting"
|
||||
exit
|
||||
fi
|
||||
$CD $TEMPDIR
|
||||
|
||||
# Get the latest WordPress package
|
||||
$RM -f $LATEST_WP
|
||||
echo "get WordPress package..."
|
||||
$WGET -qq $URL_FOR_WP_DOWNLOAD &
|
||||
show_dots $!
|
||||
|
||||
#Check download worked
|
||||
if [ ! -f "$LATEST_WP" ]; then
|
||||
echo "Unable to download WordPress from $URL_FOR_WP_DOWNLOAD"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Unzip the files
|
||||
echo "unzip WordPress package..."
|
||||
$UNZIP -q latest.zip;
|
||||
|
||||
# Remove the zip file
|
||||
echo "remove WordPress package..."
|
||||
$RM latest.zip;
|
||||
|
||||
# Copy all new files from unziped WordPress package into your installation
|
||||
echo "copy new WordPress files..."
|
||||
$CP -r wordpress/* $WEBROOT;
|
||||
echo "Create link to /etc/wordpress/wp-config.php"
|
||||
touch /etc/wordpress/wp-config.php
|
||||
ln -s /etc/wordpress/wp-config.php $WEBROOT/wp-config.php
|
||||
echo "..and reset ownership"
|
||||
$CHOWN -R www:root $WEBROOT;
|
||||
|
||||
# Remove the unzipped folder
|
||||
echo "cleanup unzipped WordPress package..."
|
||||
$RM -r wordpress/;
|
||||
|
||||
# And remove Temp dir
|
||||
$RM -R ${TEMPDIR}
|
||||
|
||||
# Output that all steps are complete
|
||||
echo "Wordpress Successfully Installed";
|
||||
|
||||
#exit from script execution
|
||||
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="www"
|
||||
PERMS=0640
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
$OUT .= "--go-into usr/share/wordpress/wp-content\n" if (($wordpress{BackupFiles} || 'enabled') eq 'enabled');
|
||||
}
|
20
root/etc/e-smith/templates/etc/e-smith/sql/init/80wordpress
Normal file
20
root/etc/e-smith/templates/etc/e-smith/sql/init/80wordpress
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
my $db = $wordpress{DbName} || 'wordpress';
|
||||
my $user = $wordpress{DbUser} || 'wordpress';
|
||||
my $pass = $wordpress{DbPassword} || 'changeme';
|
||||
$OUT .= <<END
|
||||
#! /bin/sh
|
||||
if [ -d /var/lib/mysql/$db ]; then
|
||||
exit
|
||||
fi
|
||||
/usr/bin/mysql <<EOF
|
||||
CREATE DATABASE $db DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
use $db;
|
||||
#create tables manually wiki.contribs.org/wordpress
|
||||
use mysql;
|
||||
GRANT ALL PRIVILEGES ON $db.* TO $user\@localhost
|
||||
IDENTIFIED BY '$pass';
|
||||
flush privileges;
|
||||
EOF
|
||||
END
|
||||
}
|
102
root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92wordpress
Normal file
102
root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92wordpress
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
my $status = $wordpress{'status'} || "disabled";
|
||||
return " # wordpress is disabled in this VirtualHost"
|
||||
unless $status eq 'enabled';
|
||||
|
||||
$OUT = "";
|
||||
my $allow = 'all granted';
|
||||
my $pass = '0';
|
||||
my $satisfy = 'all';
|
||||
my $name = $wordpress{'Name'} || 'Wordpress weblog';
|
||||
|
||||
for ('exit-if-none')
|
||||
{
|
||||
if ($wordpress{'PublicAccess'})
|
||||
{
|
||||
if ($wordpress{'PublicAccess'} eq 'none')
|
||||
{
|
||||
next;
|
||||
}
|
||||
elsif ($wordpress{'PublicAccess'} eq 'local')
|
||||
{
|
||||
$allow = "ip $localAccess";
|
||||
$pass = 0;
|
||||
$satisfy = 'all';
|
||||
}
|
||||
elsif ($wordpress{'PublicAccess'} eq 'local-pw')
|
||||
{
|
||||
$allow = "ip $localAccess";
|
||||
$pass = 1;
|
||||
$satisfy = 'all';
|
||||
}
|
||||
elsif ($wordpress{'PublicAccess'} eq 'global')
|
||||
{
|
||||
$allow = 'all granted';
|
||||
$pass = 0;
|
||||
$satisfy = 'all';
|
||||
}
|
||||
elsif ($wordpress{'PublicAccess'} eq 'global-pw')
|
||||
{
|
||||
$allow = 'all granted';
|
||||
$pass = 1;
|
||||
$satisfy = 'all';
|
||||
}
|
||||
elsif ($wordpress{'PublicAccess'} eq 'global-pw-remote')
|
||||
{
|
||||
$allow = "ip $localAccess";
|
||||
$pass = 1;
|
||||
$satisfy = 'any';
|
||||
}
|
||||
}
|
||||
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
$OUT .= "# wordpress - $name\n";
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
|
||||
|
||||
if (exists $wordpress{'URL'}) {
|
||||
$OUT .= "Alias /$wordpress{'URL'} /usr/share/wordpress\n";
|
||||
}
|
||||
|
||||
else {
|
||||
$OUT .= "Alias /wordpress /usr/share/wordpress\n";
|
||||
}
|
||||
|
||||
$OUT .= "\n";
|
||||
$OUT .= "<Directory /usr/share/wordpress>\n";
|
||||
|
||||
$version = "73";
|
||||
$OUT .= " <FilesMatch \.php\$\>\n";
|
||||
$OUT .= " SetHandler \"proxy:unix:/var/run/php-fpm/php$version.sock|fcgi://localhost\"\n";
|
||||
$OUT .= " </FilesMatch>\n";
|
||||
|
||||
$OUT .= " AddType application/x-httpd-php .php\n";
|
||||
#$OUT .= " php_admin_value open_basedir /usr/share/wordpress:/etc/wordpress:/tmp/:/usr/share/pear:/usr/share/php/\n";
|
||||
$OUT .= " Options ";
|
||||
$OUT .= " FollowSymLinks " if ( ($wordpress{'SymLinks'} || 'disabled') eq 'enabled');
|
||||
$OUT .= " Indexes " if ( ($wordpress{'Indexes'} || 'disabled') eq 'enabled');
|
||||
$OUT .= " None " if ((($wordpress{'Indexes'} || 'disabled') ne 'enabled') && (($wordpress{'SymLinks'} || 'disabled') ne 'enabled'));
|
||||
$OUT .= "\n AllowOverride All" if ( ($wordpress{'AllowOverrideAll'} || 'disabled') eq 'enabled');
|
||||
|
||||
#$OUT .= "\n order deny,allow\n";
|
||||
#$OUT .= " deny from all\n";
|
||||
#$OUT .= " allow from $allow\n";
|
||||
$OUT .= "\n Require $allow \n";
|
||||
|
||||
#$OUT .= " php_value mysql.default_host $wordpress{DbName}\n";
|
||||
#$OUT .= " php_value mysql.default_user $wordpress{DbUser}\n";
|
||||
#$OUT .= " php_value mysql.default_password $wordpress{DbPassword}\n";
|
||||
#$OUT .= " php_admin_value upload_tmp_dir /tmp\n";
|
||||
|
||||
if ($pass)
|
||||
{
|
||||
$OUT .= " AuthName \"$name\"\n";
|
||||
$OUT .= " AuthBasicProvider external\n";
|
||||
$OUT .= " AuthType Basic\n";
|
||||
$OUT .= " AuthExternal pwauth\n";
|
||||
$OUT .= " require valid-user\n";
|
||||
$OUT .= " Satisfy $satisfy\n";
|
||||
}
|
||||
$OUT .= "</Directory>\n";
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
{
|
||||
my $status = $wordpress{'status'} || "disabled";
|
||||
return " # wordpress is disabled in this VirtualHost"
|
||||
unless $status eq 'enabled';
|
||||
my $HTTPS = $wordpress{'Https'} || 'enabled';
|
||||
|
||||
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
|
||||
if (($port eq "80") && ($haveSSL eq 'yes') && ($HTTPS eq 'enabled'))
|
||||
{
|
||||
if (exists $wordpress{'URL'}) {
|
||||
$OUT .= " RewriteRule ^/$wordpress{'URL'}(/.*|\$) https://%{HTTP_HOST}/$wordpress{'URL'}\$1 [L,R]\n";
|
||||
}
|
||||
else {
|
||||
$OUT .= " RewriteRule ^/wordpress(/.*|\$) https://%{HTTP_HOST}/wordpress\$1 [L,R]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
root/etc/e-smith/templates/etc/wordpress/wp-config.php/10db
Normal file
21
root/etc/e-smith/templates/etc/wordpress/wp-config.php/10db
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
$OUT .= "define('DB_NAME', \'$wordpress{DbName}\'); \n";
|
||||
$OUT .= "define('DB_USER', \'$wordpress{DbUser}\'); \n";
|
||||
$OUT .= "define('DB_PASSWORD', \'$wordpress{DbPassword}\'); \n";
|
||||
$OUT .= "define('DB_HOST', \'localhost\'); \n";
|
||||
}
|
||||
|
||||
/** Database Charset to use in creating database tables. */
|
||||
define('DB_CHARSET', 'utf8');
|
||||
|
||||
/** The Database Collate type. Don't change this if in doubt. */
|
||||
define('DB_COLLATE', '');
|
||||
|
||||
/**
|
||||
* WordPress Database Table prefix.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each a unique
|
||||
* prefix. Only numbers, letters, and underscores please!
|
||||
*/
|
||||
$table_prefix = 'wp_';
|
||||
|
@@ -0,0 +1,99 @@
|
||||
/**#@+
|
||||
* Authentication Unique Keys and Salts.
|
||||
*
|
||||
* Change these to different unique phrases!
|
||||
* You can generate these using the @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
|
||||
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
{
|
||||
use MIME::Base64;
|
||||
my $pw=$wordpress{'Salt'} || "enabled";
|
||||
if ( $pw eq "enabled" )
|
||||
{
|
||||
if ( open( RANDOM, "/dev/urandom" ) )
|
||||
{
|
||||
my $buf;
|
||||
# 57 bytes is a full line of Base64 coding, and contains
|
||||
# 456 bits of randomness - given a perfectly random /dev/random
|
||||
if ( read( RANDOM, $buf, 57 ) != 57 )
|
||||
{
|
||||
warn("Short read from /dev/random: $!");
|
||||
}
|
||||
else
|
||||
{
|
||||
$pw = encode_base64($buf);
|
||||
chomp $pw;
|
||||
}
|
||||
close RANDOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pw= 'put your unique phrase here';
|
||||
}
|
||||
}
|
||||
|
||||
$OUT .= "define('AUTH_KEY', '$pw');
|
||||
define('SECURE_AUTH_KEY', '$pw');
|
||||
define('LOGGED_IN_KEY', '$pw');
|
||||
define('NONCE_KEY', '$pw');
|
||||
define('AUTH_SALT', '$pw');
|
||||
define('SECURE_AUTH_SALT', '$pw');
|
||||
define('LOGGED_IN_SALT', '$pw');
|
||||
define('NONCE_SALT', '$pw');";
|
||||
}
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* WordPress Localized Language, defaults to English.
|
||||
*
|
||||
* Change this to localize WordPress. A corresponding MO file for the chosen
|
||||
* language must be installed to wp-content/languages. For example, install
|
||||
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
|
||||
* language support.
|
||||
*/
|
||||
|
||||
{
|
||||
my $lang = $wordpress{'WpLang'} || '';
|
||||
$OUT .= "define('WPLANG', '$lang');\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* See http://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7
|
||||
*/
|
||||
|
||||
/*Allow filees to be modified allowing in place updates */
|
||||
define('DISALLOW_FILE_MODS', false);
|
||||
|
||||
/* Move to install wordpress direct, no rpm, so need to enable in place changes and updates */
|
||||
define('AUTOMATIC_UPDATER_DISABLED', false);
|
||||
|
||||
/* Need this to avoid the ftp questions on every update */
|
||||
define('FS_METHOD','direct');
|
||||
|
||||
/* Enable all core updates, including minor and major: */
|
||||
define( 'WP_AUTO_UPDATE_CORE', true );
|
||||
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*/
|
||||
{
|
||||
my $debug = $wordpress{'debug'} || "false";
|
||||
$OUT .= "define('WP_DEBUG', $debug);\n";
|
||||
}
|
||||
|
||||
/* That's all, stop editing! Happy blogging. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
define('ABSPATH', '/usr/share/wordpress/');
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once(ABSPATH . 'wp-settings.php');
|
||||
|
@@ -0,0 +1,14 @@
|
||||
{
|
||||
$OUT = <<HERE;
|
||||
<?php
|
||||
/*
|
||||
HERE
|
||||
|
||||
$OUT .=
|
||||
Text::Template::_load_text("/etc/e-smith/templates-default/template-begin");
|
||||
|
||||
$OUT .= <<HERE;
|
||||
*/
|
||||
HERE
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
?>
|
Reference in New Issue
Block a user