This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_drush_command(). | |
*/ | |
function seed_derivatives_drush_command() { | |
$items = array(); | |
$items['seed_derivatives'] = array( | |
'description' => "Create image derivatives", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crontab -e | |
* * * * * /usr/bin/php /speroteck/WSM/ultradeluxxe_original/shell/doba.php >> /home/viktor/tmp/root_cron.log 2>&1 | |
sudo tail -f /var/log/syslog | grep CRON | |
sudo tail -f /home/viktor/tmp/root_cron.log | |
sudo tail -f /speroteck/WSM/ultradeluxxe_original/var/log/dobalog.log | |
sudo htop | |
add filter "doba" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Python 2.7 installation | |
mkdir -p $HOME/.python/src | |
cd $HOME/.python/src | |
wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz --no-check-certificate | |
tar xvfz Python-2.7.6.tgz | |
cd Python-2.7.6 | |
mkdir $HOME/.python/python2.7 | |
./configure --prefix=$HOME/.python/python2.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It creates an entety instance, etity_type=taxonomy_term . | |
$term = entity_create('taxonomy_term', array( | |
'name' => 'test', | |
'vid' => 'client', | |
))->save(); | |
// urlInfo return an entity route. | |
$this->drupalGet($entity->urlInfo()); | |
$this->drupalGet($entity->urlInfo('drupal:content-translation-overview')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\language\Tests\LanguagePageCacheTest. | |
*/ | |
// d8runtest --class "Drupal\language\Tests\LanguagePageCacheTest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$variableA = 0; | |
$variableB = 1; | |
$variableC = 2; | |
if ($variableB >= $variableA) { | |
watchdog('greater_than','B great than A'); | |
} | |
if ($variableC <= $variableB) { | |
watchdog('greater_than','C less than B'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query_1 = db\ | |
.Query(UserModel, func.count(FriendModel.friend_id).label('friends'))\ | |
.select_from(UserModel)\ | |
.outerjoin(FriendModel, and_(UserModel.id==FriendModel.user_id))\ | |
.group_by(FriendModel.user_id) | |
s_1 = query_1.subquery('s_1') | |
query_2 = db\ | |
.session.query(s_1, FriendModel.status)\ | |
.select_from(s_1)\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserTable(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
username = db.Column(db.String(80), unique=True) | |
email = db.Column(db.String(120), unique=True) | |
password = db.Column(db.String) | |
user_friend = relationship('FriendTable', backref='user', foreign_keys='FriendTable.user_id') | |
friend_user = relationship('FriendTable', backref='friend', foreign_keys='FriendTable.friend_id') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$language_list = array ('ru', 'uk'); | |
foreach($article_list as $article) { | |
//$output .= print_r($article, 1); | |
$node = entity_create('node', array('type' => 'article', 'title' => $article['en']['title'], 'language' => 'en')); | |
$output .= $article['en']['title'] . '|<br>'; | |
$node->get('body')->setValue($article['en']['body']); | |
foreach ($language_list as $language) { | |
$translation = $node->getTranslation('ru'); | |
$output .= $article[$language]['title'] . '|<br>'; | |
if (empty($article[$language]['title'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
locale_config_subscriber: | |
class: Drupal\locale\LocaleConfigSubscriber | |
tags: | |
- { name: event_subscriber } | |
arguments: ['@language_manager', '@config.context'] | |
locale.config.typed: | |
class: Drupal\locale\LocaleConfigManager | |
arguments: ['@config.storage', '@config.storage.schema', '@config.storage.installer'] |