Forum

Thread tagged as: Question, Problem

Delete multiple regions?

Can I Delete empty regions in bulk?

I recent followed your tutorial to implement perch for a bi-lingual site.

Whilst doing a routine maintenance task I found out that empty regions are being created on the home page (but not others). I can't work out why but I have multiple 100's of empty regions with titles like this:

Address_Footer2 - 999' union select char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126,33),char(38,126

The biggest mystery is that I cannot recreate the problem and get this empty regions duplicated, when I manually refresh the page - it seems like there was a period of time this was happening and then it stopped.

What I want to do is delete all of these regions, but selecting them individually will take hours.

Below are my diagnostics and debug info:

Diagnostics:

PERCH INFORMATION

Perch: 2.7.4 Production mode: Production (100) Installed apps: content (2.7.4), assets (2.7.4), categories (2.7.4), perch_forms (1.7), perch_upgrade (1.4) DB driver: PDO DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users, perch_contentItems, perch_forms, perch_forms_responses, perch_pages, perch_pages_navgroups, perch_pages_templates, perch_settings, perch_users Users: 1 App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_upgrade', ); Editor plug-ins: markitup H1: 1373a9b4f89186004bb379489b8d4373 L1: f2c549c84544296c2a83b167767f44d0 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 0 content_collapseList: 1 lang: en-gb update_2.6.3: done latest_version: 2.5.3 on_sale_version: 2.7.4 headerLinkColour: #000000 linkColour: #333333 perch_pages_editorMayDeletePages: 1 perch_pages_folders: /staff editorMayDeleteRegions: 0 perch_forms_editorMayConfigure: 1 perch_forms_editorMayDelete: 1 update_2.7.4: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: cl16-peregrin PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: cl16-peregrin PERCH_DB_PREFIX: perch2_ PERCH_TZ: UTC PERCH_EMAIL_FROM: DELETED BY ME PERCH_EMAIL_FROM_NAME: Jon beveridge PERCH_LOGINPATH: /perch PERCH_PATH: /home/sites/peregrine-iom.com/public_html/perch PERCH_CORE: /home/sites/peregrine-iom.com/public_html/perch/core PERCH_RESFILEPATH: /home/sites/peregrine-iom.com/public_html/perch/resources PERCH_RESPATH: /perch/resources PERCH_HTML5: 1 PERCH_DEBUG: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/sites/peregrine-iom.com/public_html/perch/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: HOSTING SETTINGS

PHP: 5.5.9 Zend: 2.5.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $ MySQL server: 5.5.35 Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, sockets, mbstring, tokenizer, xml, cgi-fcgi, bcmath, curl, dom, enchant, fileinfo, gd, imap, intl, json, ldap, exif, mcrypt, mssql, mysqlnd, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, recode, soap, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash GD: Yes (image sharpening disabled, #66714) ImageMagick: No PHP max upload size: 64M PHP max form post size: 64M PHP memory limit: 128M Total max uploadable file size: 64M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes PATH: /usr/local/bin:/usr/bin:/bin UNIQUE_ID: VJAV0X8AAAEAACmborAAAAAG SCRIPT_URL: /perch/core/settings/diagnostics/ SCRIPT_URI: https://peregrine-iom.com/perch/core/settings/diagnostics/ HTTP_HOST: peregrine-iom.com HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36 HTTP_REFERER: https://peregrine-iom.com/perch/core/settings/diagnostics/ HTTP_ACCEPT_ENCODING: gzip,deflate,sdch HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4 HTTP_COOKIE: PHPSESSID=3i6uct5to71r9scn3bks82ga22; cmsa=1; __utma=188707881.2053824789.1418722091.1418722091.1418726603.2; __utmb=188707881.0.10.1418726603; __utmc=188707881; __utmz=188707881.1418722091.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) HTTP_CONNECTION: close SERVER_SIGNATURE: <address>Apache/2.4.9 (Unix) Server at peregrine-iom.com Port 80</address> SERVER_SOFTWARE: Apache/2.4.9 (Unix) SERVER_NAME: peregrine-iom.com SERVER_ADDR: 10.0.1.167 SERVER_PORT: 80 REMOTE_ADDR: 217.28.0.210 DOCUMENT_ROOT: /home/sites/peregrine-iom.com/public_html REQUEST_SCHEME: http CONTEXT_DOCUMENT_ROOT: /home/sites/peregrine-iom.com/public_html SERVER_ADMIN: root@localhost SCRIPT_FILENAME: /home/sites/peregrine-iom.com/public_html/perch/core/settings/diagnostics/index.php REMOTE_PORT: 54352 GATEWAY_INTERFACE: CGI/1.1 SERVER_PROTOCOL: HTTP/1.1 REQUEST_METHOD: GET QUERY_STRING: extended REQUEST_URI: /perch/core/settings/diagnostics/?extended SCRIPT_NAME: /perch/core/settings/diagnostics/index.php PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1418728914.0265 REQUEST_TIME: 1418728914

Debug: Debug Message SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='3bf0e2826425d51a56a2aa5022272739' LIMIT 1 UPDATE perch2_users SET userHash='9d7fef7af0d2a46292a00ef253bff685' WHERE userID=1 SELECT p.privKey FROM perch2_user_privileges p SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID SHOW TABLES SELECT COUNT(*) FROM perch2_users SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0 Queries: 8

Thanks.

Jon Douglas-Beveridge

Jon Douglas-Beveridge 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us the code you're using on your homepage? It sounds like you might be creating regions with no filtering on the input.

There's not a bulk delete, I'm afraid.

Hi Drew - full index.php mark up as follows.

<?php include('perch/runtime.php');?>
<?php
session_start();
if (isset($_GET['lang']) && $_GET['lang']!='') {
    $lang = $_GET['lang'];
    $_SESSION['lang'] = $lang;
}elseif (isset($_SESSION['lang'])){
    $lang = $_SESSION['lang'];
}else{
    // default language
    $lang = 'en';
}
?>
<!doctype html>
<!--[if lt IE 9]><html class="no-js oldie" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js gradient ie9" lang="en"><!--<![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)]><!--><html class="no-js" lang="en"><!--<![endif]-->

<head>
<meta charset="utf-8">

<title>Peregrine Corporate Services</title>
<meta name="description" content="Corporate Services Providers based on the Isle of Man">
<meta name="author" content="Range Left Jagged Right">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<!--[if lt IE 9]><link rel="stylesheet" href="css/ie.css"><![endif]-->
<link rel="stylesheet" href="css/royalslider.css">
<link rel="stylesheet" href="css/minimal.css">

<!--[if (lt IE 9) & (!IEMobile)]>
<script src="js/libs/selectivizr-min.js"></script>
<![endif]-->

<script src="js/libs/modernizr-2.0.6.min.js"></script>

<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/h/apple-touch-icon.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/m/apple-touch-icon.png">
<link rel="apple-touch-icon-precomposed" href="img/l/apple-touch-icon-precomposed.png">
<link rel="shortcut icon" href="img/l/apple-touch-icon.png">
<link rel="shortcut icon" href="img/favicon.ico" type="img/favicon.ico">
<link rel="icon" href="/favicon.ico" type="img/favicon.ico">
<!--[if lt IE 7 ]><script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script><script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script><![endif]-->

<link rel="canonical" href="/">
</head>

<body>

<section class="full-width paper">

<header class="container clearfix">
<aside class="lang"><a href="<?php perch_page_url(); ?>?lang=en"><img src="/perch/resources/gb-w24.png" alt="English Language Option" /></a><a href="<?php perch_page_url(); ?>?lang=ch"><img src="/perch/resources/cn-w24.png" alt="Chinese Language Option" /></a></aside>
<?php perch_content('Logo - '.$lang);?>
<?php perch_content('Nav - '.$lang);?>
</header>
</section>

<section class="container">
<div id="banner-rotator" class="royalSlider minimal">    
    <ul class="royalSlidesContainer">
        <li class="royalSlide">                     
            <img class="royalImage" src="https://src.sencha.io/https://www.peregrine-iom.com/img/burleigh-manor.jpg" width="1020" height="460" alt="picture of the exterior of burleigh manor"/>      
        </li>
        <li class="royalSlide"> 
            <img class="royalImage" src="https://src.sencha.io/https://www.peregrine-iom.com/img/boardroom.jpg" width="1020" height="460" alt="picture of PCM's boardroom"/>
        </li> 
        <li class="royalSlide"> 
            <img class="royalImage" src="https://src.sencha.io/https://www.peregrine-iom.com/img/nasa.jpg" width="1020" height="460" alt="picture of the Isle of Man from space"/>    
        </li>
    </ul> 
</div> 
</section>

<section class="container clearfix">
<div class="sixteen columns panel">
<div class="video-container">
<iframe src="https://player.vimeo.com/video/52506047" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<article class="half column">
<?php perch_content('Homepage Intro - '.$lang);?>
<div>

</div>
<?php perch_content('Find out More Button - '.$lang);?>
</article>
<article class="half column">
<?php perch_content('Why IOM list - '.$lang);?>
</article>
</div>
</section>      

<section class="container clearfix">

<aside class="one-third column alpha" id="co-icon">
<a href="/staff/index.php">
<?php perch_content('Left Panel - '.$lang);?>
</a>
</aside>

<aside class="one-third column center" id="trust-icon">
<a href="contact.php">
<?php perch_content('Middle Panel - '.$lang);?>
</a>
</aside>

<aside class="one-third column omega" id="client-icon">
<a href="about.php">
<?php perch_content('Right Panel - '.$lang);?>
</a>
</aside>

</section>

<footer class="paper-footer">
<div class="container clearfix" >
<?php perch_content('Affiliations_Footer - '.$lang);?>
<div class="sixteen columns address"><?php perch_content('Address_Footer - '.$lang);?></div>
<div class="sixteen columns address"><?php perch_content('Address_Footer2 - '.$lang);?></div>
</div>
</footer>

<!-- Scripts -->
<script src="js/libs/jquery-1.6.2.min.js"></script>
<script src="js/libs/jquery.easing.1.3.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/script.js"></script>
<script src="js/mylibs/helper.js"></script>

<!--[if (lt IE 9) & (!IEMobile)]>
<script src="js/libs/imgsizer.js"></script>
<![endif]-->

<script>
// iOS scale bug fix
MBP.scaleFix();
</script>

<script>
$('.horizontal-list').mobileMenu();
</script>
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]; // Change UA-XXXXX-X to be your site's ID
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));
</script>


</body>
</html>

Thank you.

It might also be worth mentioning at ALL the perch content regions were duplicated in the same way; not just the Address_Footer2.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You should really check to see what language you're setting. Replace this:

if (isset($_GET['lang']) && $_GET['lang']!='') {
    $lang = $_GET['lang'];
    $_SESSION['lang'] = $lang;
}elseif (isset($_SESSION['lang'])){
    $lang = $_SESSION['lang'];
}else{
    // default language
    $lang = 'en';
}

with something like this

if (perch_get('lang')) {

    switch (perch_get('lang')) {
        case 'de':
            $lang = 'de';
            break;

        case 'fr':
            $lang = 'fr';
            break;

        case 'it':
            $lang = 'it';
            break;

        default:
            $lang = 'en';
            break;
    }

}elseif (isset($_SESSION['lang'])){
    $lang = $_SESSION['lang'];
}else{
    $lang = 'en';
}

Obviously customising the language options.