Skip to content

Instantly share code, notes, and snippets.

View juslintek's full-sized avatar
🎯
Focusing

Linas juslintek

🎯
Focusing
View GitHub Profile
@juslintek
juslintek / system.log
Created January 29, 2018 21:57
Log of Magento shop
-bash-4.1$ cat system.log
2018-01-29T21:36:20+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /home/zaidimustalai/domains/zaidimustalai.lt/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 954
2018-01-29T21:36:20+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /home/zaidimustalai/domains/zaidimustalai.lt/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 954
2018-01-29T21:36:20+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /home/zaidimustalai/domains/zaidimustalai.lt/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 954
@juslintek
juslintek / Magento-shop-data.txt
Last active January 29, 2018 21:51
SHow magento data
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | value |
+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Version | 1.9.3.7 |
| Edition | Enterprise
-bash-4.1$ magerun sys:modules:list --status=active
Magento Modules
+-----------+------------------------------+----------------+--------+
| codePool | Name | Version | Status |
+-----------+------------------------------+----------------+--------+
| core | Mage_Core | 1.6.0.7 | active |
<?php
add_filter( 'the_content', function ( $content ) {
if ( is_single() && get_post_type() == 'post' ) {
$document = new DiDom\Document( $content, false );
$childElements = $document->find( '.entry-content > p' );
$maxElements = $document->count( '.entry-content > p' ) - 1;
if ($maxElements > 3) {
$randomPosition = rand( 3, $maxElements - 2);
} else {
$randomPosition = rand( 0, $maxElements);
@juslintek
juslintek / virus_fix2.sh
Created November 8, 2017 08:56
Wordpress virus fix script on VestaCP
#!/bin/bash
## You will need pwgen in order for this to work
type pwgen > /dev/null 2>&1 || { sudo yum install pwgen; exit 1; }
webrootdir=/home/admin/web/
for domaindir in $(ls $webrootdir);
do
webdir="$webrootdir$domaindir/public_html";
@juslintek
juslintek / apache.error.debug.log
Last active September 24, 2017 19:40
Redirect Debug
[Fri Sep 22 18:02:45.661481 2017] [core:error] [pid 20584] [client 172.31.1.119:35672] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661484 2017] [core:debug] [pid 20584] core.c(3628): [client 172.31.1.119:35672] AH00121: r->uri = /wp-admin/media/image1.png, referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661487 2017] [core:debug] [pid 20584] core.c(3635): [client 172.31.1.119:35672] AH00122: redirected from r->uri = /wp-admin/media/image1.png, referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661489 2017] [core:debug] [pid 20584] core.c(3635): [client 172.31.1.119:35672] AH00122: redirected from r->uri = /wp-admin/media/image1.png, referer: https:/
@juslintek
juslintek / virus_fix.sh
Last active September 19, 2017 19:38
Wordpress Cleaning Script (VestaCP specific)
#!/bin/bash
## You will need pwgen in order for this to work
echo "Enter your webroot directory"
webrootdir=/home/admin/web/
echo "For example where domain names and public html directories are located, like here: $webrootdir: "
read webrootdir;
leftovers=no
echo "Check for leftovers only? (yes/no) - default $leftovers"
@juslintek
juslintek / queries.sql
Last active September 16, 2017 09:16
Queries
SHOW STATUS LIKE 'Qcache%';
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 264909760 |
| Qcache_hits | 3208 |
| Qcache_inserts | 1232 |
| Qcache_lowmem_prunes | 0 |
@juslintek
juslintek / gist:85913ff3fc55d8da3cfb750c17913ca3
Created September 16, 2017 08:29
Explain of WP_Queries
mysql> EXPLAIN SELECT COUNT( 1 ) FROM sjwd_posts WHERE post_type = 'page' AND post_status NOT IN ( 'trash','auto-draft','inherit' ) AND post_author = 1;
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------------------+
| 1 | SIMPLE | sjwd_posts | NULL | range | type_status_date,post_author | type_status_date | 164 | NULL | 24 | 36.87 | Using index condition; Using where |
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------
@juslintek
juslintek / Seems like FastCGI error
Created November 23, 2016 18:21
This is what I get
2016/11/23 20:05:50 [error] 948#0: *560 FastCGI sent in stderr: "t/Code/100/vendor/laravel/framework/src/Illuminate/Support/helpers.php:33
PHP message: PHP 512. Illuminate\Container\Container->make() /home/vagrant/Code/100/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:462" while reading response header from upstream, client: 192.168.10.1, server: lietuva100, request: "GET /manager/lt/events/items HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "lietuva100"
2016/11/23 20:15:38 [error] 948#0: *562 FastCGI sent in stderr: "PHP message: PHP Fatal error: Maximum function nesting level of '512' reached, aborting! in /home/vagrant/Code/100/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 740
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /home/vagrant/Code/100/index.php:0
PHP message: PHP 2. Illuminate\Foundation\Application->run() /home/vagrant/Code/100/index.php:50
PHP message: PHP 3. Stack\StackedHttpKernel->handle() /home/vagrant