<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Mikrotik.moscow [тема: Упорядочить простую очередь по IP-адресам]</title>
		<link>http://mikrotik.moscow</link>
		<description>Новое в теме Упорядочить простую очередь по IP-адресам форума RouterOS на сайте Mikrotik.moscow [mikrotik.moscow]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Thu, 13 Aug 2026 15:16:49 -0400</pubDate>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377583">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Я до сих пор не понимаю, что ты имеешь в виду. Что значит «order»? Что ты пытаешься получить? Не думаю, что есть способ отсортировать массив, если только сам не напишешь скрипт для этого. <br />
			<i>02.06.2016 14:50:00, Deantwo.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377583</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377583</guid>
			<pubDate>Thu, 02 Jun 2016 14:50:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377582">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Закажи по IP, можно перемещать или сортировать по IP, но нам нужен именно порядок по IP. <br />
			<i>02.06.2016 14:40:00, LoLz.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377582</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377582</guid>
			<pubDate>Thu, 02 Jun 2016 14:40:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377581">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Что вы имеете в виду под «порядком»? Вы хотите их распечатать, отсортировав по IP-адресу? Зачем? <br />
			<i>30.05.2016 13:35:00, Deantwo.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377581</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377581</guid>
			<pubDate>Mon, 30 May 2016 13:35:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377580">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Кто-нибудь может помочь с этим? <br />
			<i>29.05.2016 21:43:00, LoLz.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377580</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377580</guid>
			<pubDate>Sun, 29 May 2016 21:43:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377579">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Да. Нужно сохранить этот файл с расширением «.php». Если у вас есть XAMPP, то нужно поместить его в папку «htdocs» внутри папки XAMPP. Для этого конкретного скрипта можно просто скачать сам PHP с php.net и запустить файл из командной строки командой «php script.php». <br />
			<i>15.06.2016 11:24:00, boen_robot.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377579</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377579</guid>
			<pubDate>Wed, 15 Jun 2016 11:24:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377578">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Я никогда не запускал API, но думаю, можно ли использовать этот скрипт с XAMPP или на любом Linux с PHP? Пожалуйста, дайте знать. <br />
			<i>15.06.2016 03:57:00, LoLz.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377578</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377578</guid>
			<pubDate>Wed, 15 Jun 2016 03:57:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377577">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Учитывая, что очереди имеют маски и интерфейсы, и что в одной очереди может быть несколько целей, это оказалось немного сложнее, чем я думал, но всё равно довольно просто. Вот пример с использованием моего API-клиента: &lt;?php<br /><br />use PEAR2\Net\RouterOS;<br /><br />require_once 'PEAR2_Net_RouterOS-1.0.0b5.phar';<br /><br />$util = new RouterOS\Util($client = new RouterOS\Client('192.168.88.1', 'admin', 'password'));<br /><br />$util-&gt;setMenu('/queue simple');<br />$queues = $util-&gt;getAll(array('.proplist' =&gt; '.id,target'))-&gt;orderBy(<br /> &nbsp; &nbsp; &nbsp; &nbsp;array(<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'target' =&gt; function ($a, $b) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Если в сравниваемых очередях несколько целей, сортируем по первой<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (strpos($a, ',') !== false) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a = explode(',', $a, 1);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a = $a[0];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (strpos($b, ',') !== false) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$b = explode(',', $b, 1);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$b = $b[0];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Если нет масок, это очередь интерфейса – сортируем по алфавиту<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (strpos($a, '/') === false && strpos($b, '/') === false) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return strcmp($a, $b);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Если одна из очередей — очередь интерфейса, она идет перед IP-очередью<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (strpos($a, '/') === false || strpos($b, '/') === false) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return strpos($a, '/') === false ? -1 : 1;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Разделяем IP и маску<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a = explode('/', $a, 2);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$b = explode('/', $b, 2);<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Переводим в целочисленный формат<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ipA = ip2long($a[0]);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$ipB = ip2long($b[0]);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$maskA = (int)$a[1];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$maskB = (int)$b[1];<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Получаем сетевой адрес<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$netA = $ipA &gt;&gt; $maskA;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$netB = $ipB &gt;&gt; $maskB;<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Сортируем по сетевому адресу; большая маска = меньшая сеть = ниже в списке<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($netA &lt; $netB) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return 1;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} elseif ($netA &gt; $netB) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return -1;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else { // Если сети одинаковы, сортируем по адресу внутри сети<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$a = ($netA &lt;&lt; $maskA) ^ $ipA;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$b = ($netB &lt;&lt; $maskB) ^ $ipB;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return $a &lt; $b ? -1 : (int) $a &gt; $b;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br /> &nbsp; &nbsp; &nbsp; &nbsp;)<br />);<br /><br />$moveRequest = new RouterOS\Request('/queue simple move');<br />foreach ($queues as $queue) {<br /> &nbsp; &nbsp;$client-&gt;sendSync($moveRequest-&gt;setArgument('numbers', $queue-&gt;getProperty('.id')));<br />} (К слову, я нашёл баг в своей реализации $util-&gt;move()… не поддерживает NULL в качестве назначения… Поэтому я для перемещения использую $client; скоро исправлю, тогда $util-&gt;move($queue('.id'), null) будет работать, что по сути равно $util-&gt;move($queue('.id'))) <br />
			<i>03.06.2016 10:24:00, boen_robot.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377577</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377577</guid>
			<pubDate>Fri, 03 Jun 2016 10:24:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377576">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Именно так, у кого-нибудь есть этот скрипт для API и PHP или сам скрипт для MK? <br />
			<i>03.06.2016 02:21:00, LoLz.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377576</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377576</guid>
			<pubDate>Fri, 03 Jun 2016 02:21:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377575">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Думаю, он имеет в виду «порядок» в смысле «перемещения». Очередь может влиять по-разному в зависимости от того, стоит ли она первой или второй в списке. Встроенного способа сортировки элементов нет, но можно сделать это самостоятельно. Как только у вас будет правильный порядок, можно пройти по ID и вызывать «move» для каждого. Вызов «move» без второго аргумента перемещает элемент в конец списка, так что в итоге ваш список будет совпадать с отсортированным. Правда, я до конца не уверен, как это реализовать... Я бы, честно говоря, из-за лени просто использовал API, получил бы все очереди, вынул IP и ID в массив (IP — в качестве ключа), отсортировал бы массив одной функцией (она есть в большинстве языков, точно в PHP), а потом пробежался по массиву и вызвал «move» с нужным ID. <br />
			<i>02.06.2016 18:10:00, boen_robot.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377575</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377575</guid>
			<pubDate>Thu, 02 Jun 2016 18:10:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Упорядочить простую очередь по IP-адресам</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377574">Упорядочить простую очередь по IP-адресам</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			У кого-нибудь есть скрипт для сортировки Simple queue по IP-адресам? <br />
			<i>13.10.2015 20:07:00, LoLz.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377574</link>
			<guid>http://mikrotik.moscow/forum/forum57/83536-uporyadochit-prostuyu-ochered-po-ip_adresam/message377574</guid>
			<pubDate>Tue, 13 Oct 2015 20:07:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
	</channel>
</rss>
