Saturday, 6 June 2026

Ganti kode plugin situs tunggal untuk shared kode


lakukan penggantian:

find . -type f -name "*.php" -exec sed -i \
"s|require_once(__DIR__ . '/../../config.php');|require_once(\$_SERVER['DOCUMENT_ROOT'] . '/config.php');|g" {} +

find . -type f -name "*.php" -exec sed -i \
"s|require_once(__DIR__ . '/../../config.php');|require_once(\$_SERVER['DOCUMENT_ROOT'] . '/config.php');|g" {} +


verifikasi:
grep -R "DOCUMENT_ROOT" .

pastikan tidak ada"
grep -R "__DIR__ . '/../../config.php'" .
cek 
require(__DIR__ . '/../../config.php');
require('../../config.php');
require_once('../../config.php');


ganti yang masih pakai:
find . -maxdepth 1 -type f -name "*.php" \
-exec sed -i \
"s|require(__DIR__ . '/../../config.php');|require_once(\$_SERVER['DOCUMENT_ROOT'] . '/config.php');|g" {} +

verifikasi lagi:
grep -R "config.php" . --include="*.php"


find . -maxdepth 1 -type f -name "*.php" -exec sed -i \
"s|require_once('../../config.php');|require_once(\$_SERVER['DOCUMENT_ROOT'] . '/config.php');|g" {} +

cek syntax error:
php -l index.php

dan
find . -name "*.php" -exec php -l {} \; | grep -v "No syntax errors"


**kirim ke stb:**
rsync -avz --delete \
/home/dhwan/moodle_all/jurnaldo/SIMG-mai/SIMG-main/ \
root@stb:/var/www/shared/local/jurnalmengajar/

**sesudah transfer:**
cd /var/www/shared/local/jurnalmengajar
find . -name "*.php" -exec php -l {} \; | grep -v "No syntax errors"
Share:

0 comments:

Post a Comment