Install & configure wordpress

#Install & configure wordpress:
cd /i-data/md0/www/pages
rm -r wordpress
wget https://wordpress.org/latest.zip
unzip latest.zip && rm -r latest.zip
chown -R nobody:nobody /i-data/md0/www/pages/wordpress/

mysql -p
CREATE DATABASE wordpress CHARACTER SET utf8;
GRANT ALL ON wordpress.* TO 'wordpress'@'%' IDENTIFIED BY 'wordpress' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;

# SQL optimizations:
#
# SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'
ADD INDEX `autoload` (`autoload`);
#
# SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  
# WHERE 1=1  AND wp_posts.post_type = 'post' 
# AND (wp_posts.post_status = 'publish')  
# ORDER BY wp_posts.post_date DESC LIMIT 10, 10;
ADD INDEX `type_status_date` (`post_type` ASC, `post_status` ASC, `post_date` ASC);
#
# SELECT ID, post_name, post_parent, post_type FROM wp_posts 
# WHERE post_name IN ('pyload-setup') AND post_type IN ('page','attachment');
ALTER TABLE `wordpress`.`wp_posts` 
DROP INDEX `post_name` ,
ADD INDEX `post name type` (`post_name`(191) ASC, `post_type` ASC);
#
# SELECT wp_posts.* FROM wp_posts WHERE 1=1  AND wp_posts.post_parent = 19  
# AND wp_posts.post_type = 'revision' AND ((wp_posts.post_status = 'inherit'))  
# ORDER BY wp_posts.post_date DESC, wp_posts.ID DESC;
ALTER TABLE `wordpress`.`wp_posts` 
DROP INDEX `post_parent` ,
ADD INDEX `post_parent_type_status` (`post_parent` ASC, `post_type` ASC, `post_status` ASC);

#Use https://adrhc.go.ro/wordpress/wp-admin/theme-editor.php to edit.
#Comment in /i-data/md0/www/pages/wordpress/wp-content/themes/twentyfourteen/style.css any:
	max-width: 1260px;
	max-width: 474px;
#Modify /i-data/md0/www/pages/wordpress/wp-content/themes/twentyfourteen/style.css to this:
	.page-content {
		background-color: #fff;
		/*padding: 12px 10px 0;*/
	}
	.site-content .entry-header {
		background-color: #fff;
		/*padding: 0 10px 12px;*/
	}
	.content-area {
		/*padding-top: 48px;*/
	}
	@media screen and (min-width: 846px) {
		.content-area,
		.content-sidebar {
			/*padding-top: 72px;*/
			padding-top: 5px;
		}
	/*p {
		margin-bottom: 24px;
	}*/
	pre {
		border: 1px solid rgba(0, 0, 0, 0.1);
		-webkit-box-sizing: border-box;
		-moz-box-sizing:    border-box;
		box-sizing:         border-box;
		/*margin-bottom: 24px;*/
		max-width: 100%;
		overflow: auto;
		padding: 12px;
		white-space: pre;
		white-space: pre-wrap;
		word-wrap: break-word;
	}
	.site-content footer.entry-meta {
		/*margin: 24px auto 0;*/
		margin: 0 auto 10px;
		padding: 0 10px;
	}
	.hentry {
		/*margin: 0 auto 48px;*/
		max-width: 672px;
	}
	.list-view .site-content .hentry {
		border-top: 1px solid rgba(0, 0, 0, 0.1);
		/*padding-top: 48px;*/
		padding-top: 10px;
	}

#Use notepadd++ for these below to edit.
#Modify /i-data/md0/www/pages/wordpress/wp-content/themes/twentyfourteen/css/editor-style.css to this:
	html .mceContentBody {
		font-size: 100%;
		/*max-width: 474px;*/
	}
#Modify /i-data/60cb70cf/www/pages/wordpress/wp-includes/css/editor.min.css to this:
	.wp-editor-container{clear:both;width:100%!important}

#Use https://adrhc.go.ro/wordpress/wp-admin/theme-editor.php to edit.
#Modify /i-data/60cb70cf/www/pages/wordpress/wp-content/themes/twentyfourteen/header.php and add:
<link rel="shortcut icon" type="image/x-icon" href="/wordpress/favicon.ico">
cp -v /i-data/60cb70cf/www/pages/resources/wordpress_favicon.ico /i-data/60cb70cf/www/pages/wordpress
#Add following in your theme’s functions.php file, or into a custom plugin:
#/i-data/60cb70cf/www/pages/wordpress/wp-content/themes/twentyfourteen/functions.php:
function show_favicon() {
	echo '<link href="/wordpress/favicon.ico" rel="icon" type="image/x-icon">';
}
add_action('admin_head', 'show_favicon');

#syntaxhighlighter text wrap (but lines number won't show ok)
grep -A 3 -B 3 -r "syntaxhighlighter table td.code .line" /i-data/md0/www/pages/wordpress/wp-content/plugins/syntax-highlighter-mt/styles/*.css
find /i-data/md0/www/pages/wordpress/wp-content/plugins/syntax-highlighter-mt/styles -name "*.css" -exec sed -i s/"syntaxhighlighter table td\.code \.line [\{]"/"syntaxhighlighter table td.code .line {white-space: pre-wrap \!important;word-wrap: break-word \!important;"/ {} \;

#Modify wordpress/wp-config.php:
define( 'DISALLOW_FILE_EDIT', true ); -> disables the Plugin and Theme editor 
// define( 'DISALLOW_FILE_MODS', true ); -> disables the Plugin and Theme Update and Installation
define('DB_NAME', 'wordpress'); -> The name of the database for WordPress

#Disable redirect for index.php to / by modifying
#/i-data/60cb70cf/www/pages/wordpress/wp-includes/canonical.php:
// add_action('template_redirect', 'redirect_canonical');
...
// add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );

#Plugins to install:
#Akismet
#OPcache Dashboard
#WP Content Filter
#WP-ServerInfo
#Syntax Highlighter MT

#APCu Object Cache Backend -> plugin as drop-in (don't install; it logging you off continuously)
mv -v /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/apcu/object-cache.php /i-data/60cb70cf/www/pages/wordpress/wp-content

#Advanced Caching -> plugin as drop-in (don't install it, it's obsolete, 7 years old)
mv -v /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/advanced-caching/advanced-caching.php /i-data/60cb70cf/www/pages/wordpress/wp-content

#Plugin WP APC Panel (dupa patch-urile de jos il copii in /public/wp-apc-panel-apc.php)
cp -v /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php /i-data/60cb70cf/www/pages/public/wp-apc-panel-apc.php
#ERROR1:
	PHP Notice:  Undefined index: page in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/wp_apc_panel.php on line 30
#SOLUTION1:
	/*
		echo '<div name****>';
		echo 'is_user_logged_in = ' . is_user_logged_in() . '<br>';
		echo 'in_array = ' . in_array( 'administrator', $user->roles ) . '<br>';
		var_dump($_GET);
		echo '<br>';
		echo 'array_key_exists = ' . array_key_exists('page', $_GET) . '<br>';
		echo 'page = ' . isset( $_GET['page'] );
		echo '</div>';
	*/
	if( is_user_logged_in() &&				-> existing line
		in_array( 'administrator', $user->roles ) &&	-> existing line
		isset( $_GET['page'] ) &&
		$_GET['page'] == 'wp-apc-panel-page' &&		-> existing line
#ERROR2:
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 832
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 853
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 866
#SOLUTION2 (modify /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php):
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 832
		$locking_type = isset($cache['locking_type']) ? $cache['locking_type'] : 'no';
		echo <<<EOB
			<tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size 
		<br/> ({$cache['memory_type']} memory, $locking_type locking)
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 853,
	Notice: Undefined index: expunges in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 866
		$cache_expunges = isset($cache['expunges']) ? $cache['expunges'] : '0';
		$cache_user_expunges = isset($cache_user['expunges']) ? $cache_user['expunges'] : '0';
		echo <<<EOB
			...
			<div class="info div1"><h2>File Cache Information</h2>
			...
			<tr class=tr-1><td class=td-0>Cache full count</td><td>$cache_expunges</td></tr>
			...
			<tr class=tr-1><td class=td-0>Cache full count</td><td>$cache_user_expunges</td></tr>
#ERROR3:
	Notice: Undefined index: filename in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 1131
#SOLUTION3:
	} else {
		$entry_fieldname = isset($entry[$fieldname]) ? $entry[$fieldname] : 'no ' . $fieldname;
		$list[$k.$entry_fieldname]=$entry;
		// $list[$k.$entry[$fieldname]]=$entry;
	}
#ERROR4:
	Notice: Undefined index: filename in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 1150
#SOLUTION4:
	$entry_fieldname = isset($entry[$fieldname]) ? $entry[$fieldname] : 'no ' . $fieldname;
	if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry_fieldname) != 0) {  
        	$field_value = htmlentities(strip_tags($entry_fieldname,''), ENT_QUOTES, 'UTF-8');
#ERROR5:
	Notice: Undefined index: mtime in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 1158
#SOLUTION5:
	$entry_mtime = isset($entry['mtime']) ? date(DATE_FORMAT,$entry['mtime']) : '-';
	...
	  '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>',
	  '<td class="td-n center">',$entry_mtime,'</td>',
#ERROR6:
	Notice: Undefined index: filename in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 1264
#SOLUTION6:
	foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $entry) {		-> existing line
		$n = isset($entry['filename']) ? dirname($entry['filename']) : '-';
		if ($MYREQUEST['AGGR'] > 0) {									-> existing line
#ERROR7:
	Undefined index: filename in /i-data/60cb70cf/www/pages/wordpress/wp-content/plugins/wp-apc-panel/include/apc.php on line 1154
#SOLUTION7:
	$entry_fieldkey = isset($entry[$fieldkey]) ? md5($entry[$fieldkey]) : '';
	echo																-> existing line
	  '<tr class=tr-',$i%2,'>',										-> existing line
	  "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",$entry_fieldkey,"\">",$field_value,'</a></td>',	

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.