Skip to content

Instantly share code, notes, and snippets.

View webnitros's full-sized avatar

Андрей webnitros

View GitHub Profile
<?php
/**
* Enable an Newsletter
*/
class bxQueueTestingProcessor extends modObjectGetProcessor
{
/** @var bxQueue $object */
public $object;
public $objectType = 'bxQueue';
<?php
interface bxMailingInterface
{
/**
* Send message queue to service
*
* @return array|boolean $response
*/
@webnitros
webnitros / bulk_update_value.php
Created August 9, 2019 03:23
Массовое обновление значение у таблицы на PHP mysql
/* @var msVendor $object */
$q = $modx->newQuery('msVendor');
#$q->limit(1);
if ($objectList = $modx->getCollection('msVendor', $q)) {
foreach ($objectList as $object) {
$vendors[$object->get('id')] = $object->get('uuid');
}
}
$ids = implode(',', array_keys($vendors));
@webnitros
webnitros / git.php
Created August 9, 2019 03:46
Массовый git rm
<?php
$vendor = '
# deleted: _data/vendors/10.chiaro.yaml
# deleted: _data/vendors/100.fagerhult.yaml
';
$vendor = explode('# deleted: ', $vendor);
$vendor = array_map('trim', $vendor);

configuring opendkim with postfix on ubuntu

Replace example.com with your domain. All occurrences of the string 'mail' are know as the selector and can be any alpha numeric string.

Install opendkim:

$ sudo apt-get install opendkim opendkim-tools
/******
* select combo
* */
// Context
mspre.combo.Context = function (config) {
config = config || {}
if (config.custm) {
config = getDefaultConfig(config)
@webnitros
webnitros / dublicatephp
Created September 7, 2019 15:03
Поиск дублей в поле
$q = $modx->newQuery('msProductData');
$q->select('id,COUNT(article) as count,article');
$q->groupby('article');
$q->having('count > 1');
$q->prepare(); echo '<pre>'; print_r($q->toSQL()); die;
if ($q->prepare() && $q->stmt->execute()){
while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
@webnitros
webnitros / generate.php
Created February 26, 2020 10:17
Генерация файла со всеми изображениями
<?php
/*header('Access-Control-Allow-Origin: *');
header("Content-type: application/json; charset=utf-8");*/
ini_set('display_errors', 1);
ini_set("max_execution_time", 1000);
define('MODX_API_MODE', true);
require 'index.php';
if (!$modx->getAuthenticatedUser('mgr')) {
die('Access is denied');
<?php
/*header('Access-Control-Allow-Origin: *');
header("Content-type: application/json; charset=utf-8");*/
ini_set('display_errors', 1);
ini_set("max_execution_time", 1000);
define('MODX_API_MODE', true);
require 'index.php';
if (!$modx->getAuthenticatedUser('mgr')) {
die('Access is denied');
/* @var Formalicious $Formalicious */
$Formalicious = $modx->getService('formalicious', 'Formalicious', MODX_CORE_PATH . 'components/formalicious/model/formalicious/');
/* @var cmlUser $cmlUser */
$cmlUser = $modx->getService('cmluser', 'cmlUser', MODX_CORE_PATH . 'components/cmluser/model/');
/* @var cmlUserId $object */
$q = $modx->newQuery('cmlUserId');
if ($objectList = $modx->getCollection('cmlUserId', $q)) {