Вибачте цей текст доступний тільки в “Російська”.
Автор: admin
(Russian) umi ups
(Russian) Nextcloud virtual dirctory/file/disk in macos
(Russian) WSL Compact
(Russian) Auto mount without fstab
(Russian) Добавление альтернативной версии PHP 8.1 на ISPmanager 5 Lite
(Russian) Сжатие таблиц
(Russian) beast tool cli linux
(Russian) regulator power cpu
(Russian) Not work sound elementary 6 notebook HP
(Russian) ADD flatpak
(Russian) старт проекта на fin
(Russian) Redmine после обновления некоторых плагинов в докерах редмайн перестал подниматся
(Russian) Набор полезных функций
(Russian) Обновление БД c ispmanager
(Russian) exim4 удалить писма в статусе “заморозка”
(Russian) MF4410 установка драйвера Windows 10, сканер устанавливаетвся принтер нет
(Russian) Hyper-V на Windows 10 home
(Russian) ISP Let’s Encrypt cli update
(Russian) консольное правильное удаление драйверов с Windows 10
(Russian) Drupal 8 optimization image + afto add webp files
(Russian) Настроить ssh.exe вместо putty
(Russian) Clone ssd to another ssd less size
(Russian) Fail2ban Основные команды
(Russian) Заменить все ссылки через wp cli
(Russian) проверить заголовок ответа
Drupal 8 commerce2 add custom field checkout
https://www.drupal.org/project/commerce_checkout_order_fields. Just enable it, go to /admin/commerce/config/order-types/default/edit/form-display, scroll down, enable 'Checkout' view, drag/drop fields on the Checkout view, and then go to /admin/commerce/config/checkout-flows/manage/default and add 'Order Fields: Checkout' pane to a step you want. Enjoy
Некие команды для ./occ
Выполнять от юзера www-data
docker exec -it -u 82 dockername /bin/sh
./occ upgrade - обновляет базу
./occ files:scan --all
./occ files:scan grenuy
./occ files:scan --path "grenuy/files/Share uWorld"
sudo -u www-data php occ files:scan --help Usage: files:scan [-p|--path="..."] [-q|--quiet] [-v|vv|vvv --verbose] [--all] [user_id1] ... [user_idN] Arguments: user_id will rescan all files of the given user(s) Options: --path limit rescan to the user/path given --all will rescan all files of all known users --quiet suppress any output --verbose files and directories being processed are shown additionally during scanning --unscanned scan only previously unscanned files
Смотреть скорость чтения\записи
dstat -tdD total,sda,sdb,sdc 60
docker stack deploy yml
Для загрузки без docker-compose файл compose.yml можно создать стек такой командой
docker stack deploy --compose-file docker-composer-portainer.yml portainer
Index column size too large. The maximum column size is 767 bytes.
Проблема много где описана, но решается на уровне рута и настройки базы данных
mysql
set global innodb_file_format = BARRACUDA;
set global innodb_large_prefix = ON;
SET GLOBAL innodb_default_row_format = DYNAMIC;
Смотреть нагрузки на диски
dstat -tdD total,sda,sdb,sdc 60
получение данных параграфа с ноды
$node = \Drupal\node\Entity\Node::load($nid);
$node->field_kharakteristiki[0]->entity->field_title->value;
Kint limit
<?php
kint_require();
Kint::$maxLevels = 4;
kint($node);
mount USB media in wls(windows linux)
Good news, it is now possible to mount USB media (including FAT formated) and network shares with drvfs on Windows 10:
Mount removable media: (e.g. D:)
$ sudo mkdir /mnt/d
$ sudo mount -t drvfs D: /mnt/d
To safely unmount
$ sudo umount /mnt/d
You can also mount network shares without smbfs:
$ sudo mount -t drvfs '\\server\share' /mnt/share
You need at least Build 16176 so you might have to opt-in to the Windows Insider programm and then update Windows. Source:
Новые бэкапы ISPtar в ISPmanager
Компания ISPsystem в панелях ISPmanager начиная с версии 5.51 выпустила новую версию бэкапов.
Называются ISPtar.
Сюда буду писать интересные фичи и ошибки.
Бэкап обного пользователя
ISPmanager 5 Litesbin/backup2 имя_пользователя
ISPmanager 5 Businesssbin/backup2_pro имя_пользователя
Если бэкап за сегодня есть а потестить надо, то указываем фэйковую дату:bin/backup2_pro user --date 2016-04-01
Ошибка:backup ERROR isptar finished with error 1. Output: No header found
Проблема в бинарнике ISPtar? бэкапим старый, ставим новый:
Можно командойwget -O /usr/local/mgr5/sbin/isptar http://sis-admin.su/wp-content/uploads/2016/01/ваша_версия_tar
Распаковка бэкапов вручную
Переходим в папку с бэкапом:
/usr/local/mgr5/sbin/isptar -x F2016-10-18.user.tgz data/www/dipris.ru/ -R /var/www/user/site.ru
Где
F2016-10-18.user.tgz — название бэкапа, берётся из файла F2016-10-18.user.tgz.part1 Такого файла нет.
data/www/dipris.ru/ — Файлы какого сайта необходимо восстановить
/var/www/user/site.ru — Куда восстановить данные
Базы лежат в папке .system/
Пример распаковки базы base:
/usr/local/mgr5/sbin/isptar -x F2016-10-18.user.tgz .system/db.mysql.base -R /var/www/user/site.ru
Удаление 5 миллионов файлов
Обычно предлагается удалять через find и рабочий вариант, но в моем случаи 1.5млн удаляло часов 10 что недопустимо долго так перебирать пошел другим путем через цыклы и маски
for i in {a..z}
do
rm /var/www/*/data/www/*/system/sessions/sess_$i[a-c]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[d-g]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[h-k]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[l-n]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[p-r]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[s-v]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[w-y]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[y-z]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[0-2]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[3-5]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[6-8]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[8-9]*
rm /var/www/*/data/www/*/system/sessions/sess_$i*
done
for i in {0..9}
do
rm /var/www/*/data/www/*/system/sessions/sess_$i[a-c]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[d-g]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[h-k]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[l-n]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[p-r]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[s-v]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[w-y]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[y-z]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[0-2]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[3-5]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[6-8]*
rm /var/www/*/data/www/*/system/sessions/sess_$i[8-9]*
rm /var/www/*/data/www/*/system/sessions/sess_$i*
done
Или удалить файлы, которые старше семи дней:
for f in /tmp/logs/*.log
do
find $f -mtime +7 -exec rm {} \;
done
Удаление заняло несколько минут времени.
VARNISH
varnishlog
nginx -s reload && service varnish restart
drush composer subsytem linux in Windows 10
composer global require drush/drush:8 nano .profile add PATH="$HOME/.config/composer/vendor/bin:$PATH" source ~/.profile
Windows 10 subsystem ubuntu apache2 + mysql
sudo su
apt update
apt install apache2 mysql
nano /etc/apache2/sites-available/sites.loc.conf
# Place any notes or comments you have here
# It will make any customisation easier to understand in the weeks to come
# domain: domain1.com
# public: /home/demo/public_html/domain1.com/
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster@domain1.com
ServerName sites.loc
ServerAlias www.sites.loc
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /mnt/c/work/website/sites.loc/html
# Custom log file locations
LogLevel warn
ErrorLog /var/log/apache2/error-mydomainname.com.log
CustomLog /var/log/apache2/access-mydomainname.com.log combined
</VirtualHost>
add in
nano /etc/apache2/apache2.conf
<Directory /mnt/c/work/website/*> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all Require all granted </Directory>
a2ensite sites.loc
service apache2 restart
add in c:\Windows\System32\drivers\etc\hosts
127.0.0.1 cprice.loc
a2enmod rewrite
service apache2 restart
Find the php.ini on your server. In wamp you click on the toolbar icon -> select PHP -> select php.ini
Push ctrl+ f and find "realpath_cache_size" . Remove the semi-colon at the beginning of the line and make it =16M instead of 16k .
This all
Монтирование раздела
sudo mkdir /media/exfat
sudo mount -t exfat /dev/sdc1 /media/exfat
sudo umount /dev/sdc1
Drupal 8 commerce adress field translate
Нужно отредактировать файл
/vendor/commerceguys/addressing/resources/subdivision/UA.json
{
"country_code": "UA",
"locale": "ru",
Drupal 8 twig print without comments
{{ content.field_ssylka|render|striptags|trim }}
example:
<a href="{{ content.field_ssylka|render|striptags|trim }}">
{{ content.field_ikonka_sverkhu }}
{{ content.field_jgb }}
</a>
Что бы скачать с googledrive любые по размеру файлы без вопросов нужно подменить FILEID
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
(Russian) Легкая установка разных версий руби
(Russian) SSL https free auto crbot
(Russian) SSH создать публичный ключ, добавить на машину
(Russian) Обновить в Debian php с 5.4 до 5.5 или 5.6
(Russian) ispmanager 4 change phpversion
(Russian) Drupal настройка bootstrap темы radix
(Russian) Gulp example projext sass jade browsync on windows
(Russian) Быстрая устанвока всех программ на Windows
Commit in arhive
На одном из проектов нужно было давать архив всех измененых файлов с каталогами. Причем именно архив. Первая мысль git но блин на сервере у клиента нельзя установить гит, а его админ доступов не дает, и только архив с изменениями хочет. Нашел выход достаточно простой который решил мои проблемы
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT idCommit | tar -czf file.tgz -T -
idCommit - наш индификатор коммита
Установка Drupal через drush
Установить друпал можно через командную строку в одну строку!!!! Ну если быть точнее через две.
#Первая строка скачивает drupal
drush dl drupal
#установка друпалла
drush site-install standard --account-name=LoginAdmin --account-pass=passwordAdmin --db-url=mysql://UserDB:PasswordDB@localhost/NameDB
Больше команд можно почитать здесь
Сброс DNS в Windows 10 \ 8 \ 8.1
cmd от админа
1. ipconfig /release
2. ipconfig /renew (может долговато выполняться)
3. ipconfig /flushdns
Все, вот так просто три команды и проблем нет 🙂
Попытка получить тиц 10
Первый шаг, попытаюсь зарегаться на сайте dir.ikernel.org, они очень просили опубликовать обратную ссылку, вот и опубликую здесь 🙂
Глобальный каталог сайтов
Drush worck shop
.gitignore not working
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
DRUSH
drush up — обновление ядра и модулей Drupal.
drush cc all — очистка всего кеша сайта.
drush pm-list — список всех модулей и тем установленных на сайте, а также их версии и статус активности.
drush dl module — загружает модуль или тему. Несколько значений пишится через пробел.
drush en module — включает указанный модуль или тему.
drush dis module — выключает указанный модуль или тему.
drush ard — создание бэкапа сайта. Делает бэкап как самого сайта, так и базы данных, все это сохраняется в tar.gz архиве. Невероятно удобная вещь.
drush arr path — восстановление бекапа созданного командой drush ard. Заместо path нужно указать путь до архива, включая его название и расширение.
Установка drupall
drush dl drupal-7.x
drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase
Розпаковка архива на другой сервер
drush arr nivea.20150415_200549.tar.gz --db-url=mysql://root@localhost:3306/nivea
drush uli - получить разовую ссылку на вход для админа
drush upwd admin --password="newpassword" - сбросить пароль для пользователя
Convert image type windows cmd
Сначала нужно выполнить в cmd
а далее просто
mogrify -quality 60 -format jpg *.png
И все чудно перегониться с jpg в png и сохранить 60% качества
cinst chocolatey.org apt-get для Windows
Не так давно открыл для себя прелестную возможность у Windows того что очень не хватало, и одно из того чем очень сильно привлекает linux, это установка приложений из командной строки а так же обновления всех приложений одной командой
Очень клево будте для различных админов или "настройщиков" Windows
можно установить 90% всех необходимых программ(а то и все 100%) просто выполнив в cmd
cinst flashplayerplugin flashplayeractivex notepadplusplus sublimetext2 7zip GoogleChrome javaruntime Firefox flashplayerplugin adobereader ccleaner sysinternals putty filezilla dropbox skype paint.net virtualbox DotNet4.5 Wget ConEmu libreoffice PDFCreator teamviewer wuinstall.run
Все происходит с помощью "тихой установки" не задавая лишних вопросов и что важно не устанавливая лишние программы )
Что бы работала такая установка всего то нужно выполнить в командной строке
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
Возможные пакеты можно глянуть на сайте
chocolatey.org
Массовое применение patch drupal 7.32
Для того что применить к всем пользователям патч нужно создать файл на сервере (к примеру в корне) с именем к примеру
pathc.patch. Текст в файле, в нашем случаи можно взять, здесь https://www.drupal.org/files/issues/SA-CORE-2014-005-D7.patch
И зайдя через SSH выполнить команду
for i in /home/www/*/data/www/* ; do cd "$i"; echo "$i"; patch -p1 < /patch.patch; done
Путь конечно же под ваш сервер, у меня первая звездочка это пользователи на сервере, вторая сайты.
Анимация css
Пример анимации на CSS очень прикольно! 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .uwloader{ background: url(http://my-opinions.info/wp-content/uploads/2014/09/preloader.png) no-repeat; background-size: 80px 80px; position: fixed; top: 50%; left: 50%; margin-left: -30px; margin-top: -30px; width: 80px; height: 80px; -webkit-animation: rotateplane 2s infinite ease-in-out; animation: rotateplane 2s infinite ease-in-out; } @-webkit-keyframes rotateplane { 0% { -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg) } 25% { -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg) } 50% { -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg) } 75% { -webkit-transform: perspective(120px) rotateX(0deg) rotateY(-179.9deg) } <a href="http://my-opinions.info/en/programing/css/animaciya-css#more-266" class="more-link">Continue reading <span class="screen-reader-text">Анимация css</span></a> |
Дробное количество ubercart 3
ubercard 3.5 нашел решения с некоторыми коректировками
// making the product quantities FLOAT instead INTEGER Drupal 7, Ubercart 3.1
//// DATABASE CHANGES Four ubercart tables alterations are made from sql terminal (mysql -u ADMIN_USER -p , use DATABASE_NAME )
1) The UC_CART_PRODUCTS table intersect the UC_CARTS table and the UC_PRODUCTS table. The column ц╒Б┌╛е⌠qtyц╒Б┌╛б² is the one to ajust. Here is the MySQL statement that will modify the column to a FLOAT data type:
ALTER TABLE `uc_cart_products` MODIFY COLUMN `qty` FLOAT(6,2) UNSIGNED NOT NULL DEFAULT 0;
2) The UC_ORDERS table holds all the orders created. The column to adjust is ц╒Б┌╛е⌠product_countц╒Б┌╛б².
ALTER TABLE `uc_orders` MODIFY COLUMN `product_count` FLOAT(6,2) UNSIGNED NOT NULL DEFAULT 0; 3) The UC_PRODUCTS table contains a
default_qty field. This value gets inserted into both the product edit page and the product view page (for the customer). I think it would be a good idea to show the customer how many decimal places one may use.
ALTER TABLE `uc_products` MODIFY COLUMN `default_qty` FLOAT(6,2) UNSIGNED NOT NULL DEFAULT 1.00;
4) The UC_ORDER_PRODUCTS table intersects the UC_ORDERS table and the UC_PRODUCTS table. The column to adjust is the ц╒Б┌╛е⌠qtyц╒Б┌╛б² column. Here is the MySQL statement that will modify the column to a FLOAT data type:
ALTER TABLE `uc_order_products` MODIFY COLUMN `qty` FLOAT(6,2) UNSIGNED NOT NULL DEFAULT 0;
//// CODE CHANGES // FIRST uc_order -> uc_order.install //Change array elements in function to: /** * Increase maximum order item quantity. */
function uc_order_update_7003() { db_change_field('uc_order_products', 'qty', 'qty', array( 'description' => 'The number of the same product ordered.', 'type' => 'float', 'precision' => 6, 'scale' => 1, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1.0, )); }
// SECOND
uc_order -> uc_order.install In $schema['uc_order_products'] change: 'qty' => array( 'description' => 'The number of the same product ordered.', 'type' => 'int', 'size' => 'small', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ),
To:
'qty' => array( 'description' => 'The number of the same product ordered.', 'type' => 'float', 'precision' => 6, 'scale' => 1, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1.0, ),
// THIRD uc_product -> uc_product.module //For possibility of using 0.00 to 1.00 quantites in function uc_product_uc_update_cart_item change: (string 1052) p.s. С новыми версиями функция поменялась, я сменил на функцию на старую версию, пока все ок 🙂
</pre> <pre class="php"><code><span class="php-keyword">function</span> <span class="php-function-or-constant"><a class="local active" title="Implements hook_uc_update_cart_item()." href="http://drupalcontrib.org/api/drupal/contributions%21ubercart%21uc_product%21uc_product.module/function/uc_product_uc_update_cart_item/7">uc_product_uc_update_cart_item</a></span>(<span class="php-variable">$nid</span>, <span class="php-variable">$data</span> = <span class="php-keyword">array</span>(), <span class="php-variable">$qty</span>, <span class="php-variable">$cid</span> = <span class="php-function-or-constant">NULL</span>) { <span class="php-keyword">if</span> (!<span class="php-variable">$nid</span>) { <span class="php-keyword">return</span> <span class="php-function-or-constant">NULL</span>; } <span class="php-variable">$cid</span> = !(<span class="php-function-or-constant">is_null</span>(<span class="php-variable">$cid</span>) || <span class="php-keyword">empty</span>(<span class="php-variable">$cid</span>)) ? <span class="php-variable">$cid</span> : <span class="php-function-or-constant"><a class="local" title="Returns the unique cart_id of the user." href="http://drupalcontrib.org/api/drupal/contributions%21ubercart%21uc_cart%21uc_cart.module/function/uc_cart_get_id/7">uc_cart_get_id</a></span>(); <span class="php-keyword">if</span> (<span class="php-variable">$qty</span> < <span class="php-constant">1</span>) { <span class="php-function-or-constant"><a class="local" title="Removes an item from the cart." href="http://drupalcontrib.org/api/drupal/contributions%21ubercart%21uc_cart%21uc_cart.module/function/uc_cart_remove_item/7">uc_cart_remove_item</a></span>(<span class="php-variable">$nid</span>, <span class="php-variable">$cid</span>, <span class="php-variable">$data</span>); } <span class="php-keyword">else</span> { <span class="php-function-or-constant"><a class="local" title="Returns a new UpdateQuery object for the active database." href="http://drupalcontrib.org/api/drupal/drupal%21includes%21database%21database.inc/function/db_update/7">db_update</a></span>(<span class="php-string">'uc_cart_products'</span>) -><span class="php-function-or-constant"><a class="local" title="Multiple implementations exist." href="http://drupalcontrib.org/api/search/7/fields">fields</a></span>(<span class="php-keyword">array</span>( <span class="php-string">'qty'</span> => <span class="php-variable">$qty</span>, <span class="php-string">'changed'</span> => <span class="php-function-or-constant"><a class="local" title="Time of the current request in seconds elapsed since the Unix Epoch." href="http://drupalcontrib.org/api/drupal/drupal%21includes%21bootstrap.inc/constant/REQUEST_TIME/7">REQUEST_TIME</a></span>, )) -><span class="php-function-or-constant"><a class="local" title="Multiple implementations exist." href="http://drupalcontrib.org/api/search/7/condition">condition</a></span>(<span class="php-string">'nid'</span>, <span class="php-variable">$nid</span>) -><span class="php-function-or-constant"><a class="local" title="Multiple implementations exist." href="http://drupalcontrib.org/api/search/7/condition">condition</a></span>(<span class="php-string">'cart_id'</span>, <span class="php-variable">$cid</span>) -><span class="php-function-or-constant"><a class="local" title="Multiple implementations exist." href="http://drupalcontrib.org/api/search/7/condition">condition</a></span>(<span class="php-string">'data'</span>, <span class="php-function-or-constant">serialize</span>(<span class="php-variable">$data</span>)) -><span class="php-function-or-constant"><a class="local" title="Multiple implementations exist." href="http://drupalcontrib.org/api/search/7/execute">execute</a></span>(); } }
if ($qty < 1) {
CHANGE TO:
if ($qty == 0) {
// FOURTH uc_order -> uc_order.admin.inc //Not sure if it's necessary but just in case (string 1125)
if (!isset($product['remove']) && intval($product['qty']) > 0) {
CHANGE TO:
if (!isset($product['remove']) && ($product['qty']) > 0) {
//FIFTH uc_cart -> uc_cart.install //Not sure if it's necessary but just in case CHANGE TO FLOATS: (string 37)
'qty' => array( 'description' => 'The number of this product in the cart.', 'type' => 'float', 'precision' => 6, 'scale' => 1, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1.0,
AND (string 126)
function uc_cart_update_7001() { db_change_field('uc_cart_products', 'qty', 'qty', array( 'description' => 'The number of this product in the cart.', 'type' => 'float', 'precision' => 6, 'scale' => 1, 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1.0, )); }
/*uc_store\uc_store.module*/ /*chenge */
function uc_store_validate_uc_quantity(&$element, &$form_state) { if (!preg_match('/^\d+$/', $element['#value'])) { form_error($element, t('The quantity must be a number.')); } elseif (empty($element['#allow_zero']) && !$element['#value']) { form_error($element, t('The quantity cannot be zero.')); } }
/*on*/
function uc_store_validate_uc_quantity(&$element, &$form_state) { if (!preg_match("/([0-9\.-]+)/", $element['#value'])) { form_error($element, t('The quantity must be a number.')); } elseif (empty($element['#allow_zero']) && !$element['#value']) { form_error($element, t('The quantity cannot be zero.')); } }
Drush update all module and drupal automatic more site
Как всегда не буду тянуть заходим в SSH и вводим такую вот строчку
for i in /home/www/grenuy/data/www/*/sites/.. ; do cd "$i"; drush updb; drush en update; yes | drush pm-update ; drush up drupal ; drush updb ; done
grenuy это имя пользователя путь может быть немного видоизмененным в зависимости от сервера.
Скрипт может давать сбои и error, при сбои создается папка с именем drupal-7.** перенеся от туда файлы в корень сайта восстановиться сайт.
обновляет как и 7-ку так и 6-ку в построчечный режим выполнения команд такой(в корне сайта выполняться)
drush en update
drush pm-update
drush up drupal
drush updb
(Russian) Denwer бекап Mysql
(Russian) Alis .htaccess правельный редирект
(Russian) Мастер класс по web-development
(Russian) drupal 6 node_import ANSI to utf
(Russian) shell команда find
(Russian) Архивация-разархивация через SSH
Вложеный запрос в codeignator
Как всегда мало водного текста, сразу код, ниже немного разъяснения по нему
1 2 3 4 5 6 7 8 9 10 11 | $this->db->select("*") ->from("schedule") ->order_by("schedule.dayofweek", "asc") ->order_by("schedule.lesson_number", "asc") ->order_by("date_approve", "desc"); $s = $this->db->_compile_select(); $this->db->_reset_select(); $dbprefix = $this->db->dbprefix; $this->db->set_dbprefix(''); $this->db->select("*") ->from('(' . $s . ') as ' . $this->db->dbprefix . 'schedule_tmp'); <a href="http://my-opinions.info/codeigniter/vlozhenyj-zapros-v-codeignator#more-171" class="more-link">Читать далее <span class="screen-reader-text">Вложеный запрос в codeignator</span></a> |
В результате получим вот такой вот запрос
1 2 3 4 5 6 7 8 9 | SELECT * FROM ( SELECT * FROM `uw_schedule` ORDER BY `uw_schedule`.`dayofweek` ASC, `uw_schedule`.`lesson_number` ASC, `uw_schedule`.`date_approve` DESC ) AS uw_schedule_tmp LEFT JOIN `uw_lessons` ON `uw_lessons`.`lesson_id` = `uw_schedule_tmp`.`lesson_id` LEFT JOIN `uw_students` ON `uw_schedule_tmp`.`class_id` = `uw_students`.`class_id` WHERE `uw_schedule_tmp`.`class_id` = 0 AND `uw_schedule_tmp`.`date_approve` < '2012-06-29 14:59:00' GROUP BY uw_schedule_tmp.dayofweek, uw_schedule_tmp.lesson_number |
Скорее всего вы столкнетесь с проблемой что методы
_compile_select();
_reset_select();
protected, а соответственно их можно использовать только в нутри класса, честно говоря не разберался как обойти эту ситуацию и просто поменял их в ядре на public, если кто разберется, напишите пожалуйста, исправлю статью, и себе на заметку.. )
И так теперь по коду,
$this->db->dbprefix Получает текущий префикс, если Вам он не нужен то можно пропустить использования этого метода
_compile_select() Возращает запрос в переменую
_reset_select();