Jump to content

horst

PW-Moderators
  • Posts

    4,077
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. Yeah ok, but have you seen the 7'th entry: www.fbi.gov I never had thought that!
  2. This is already ready with Somas Modules Manager. It can check by a selectable period (lazy cron I think) and email you only if there are updates for you. (named: Modules Manager Notification)
  3. so what is /return-pw/ ?? Is return-pw a physical path beneath your doc_root? If yes, does it contain the download.php ??
  4. @Steve: great! Will you add the handler (apache_module or fcgi) and the MaxMemory to the PHP section?
  5. Oh, my fault. It was a typo: I meant in the parent::install() function, not the init(). Sorry.
  6. No problem! But it is hard to follow, if something like this isn't in the info. Great! And your files are protected now, even if the url is known?
  7. Here is the getImagesDiagnostics(): protected function getImagesDiagnostics() { // check for GD-lib if(!function_exists('gd_info')) { #$results['images'][] = array( $results[] = array( 'title' => $this->_('GD library'), 'value' => $ver, 'status' => self::$fail, 'action' => $this->_('There seems to be no GD-library installed!') ); } else { $gd = gd_info(); $ver = isset($gd['GD Version']) ? $gd['GD Version'] : $this->_('Version-Info not available'); $jpg = isset($gd['JPEG Support']) ? $gd['JPEG Support'] : false; $png = isset($gd['PNG Support']) ? $gd['PNG Support'] : false; $gif = isset($gd['GIF Read Support']) && isset($gd['GIF Create Support']) ? $gd['GIF Create Support'] : false; $freetype = isset($gd['FreeType Support']) ? $gd['FreeType Support'] : false; // GD version #$results['images'][] = array( $results[] = array( 'title' => $this->_('GD library'), 'value' => $ver, 'status' => self::$ok, 'action' => '' ); // PHP with GD bug ? if((version_compare(PHP_VERSION, '5.5.8', '>') && version_compare(PHP_VERSION, '5.5.11', '<'))) { if(version_compare($this->config->version, '2.4.1', '<')) { #$results['images'][] = array( $results[] = array( 'title' => $this->_('GD library Bug'), 'value' => 'possible bug in GD-Version', 'status' => self::$warn, // @steve: or better use self::fail ? 'action' => $this->_('Bundled GD libraries in PHP versions 5.5.9 and 5.5.10 are known as buggy. You should update A) your PHP version to 5.5.11 or newer, or B) the ProcessWire version to 2.4.2 or newer') ); } } // GD supported types foreach(array('JPG', 'PNG', 'GIF', 'FreeType') as $v) { $name = $this->_(sprintf('GD %s Support', $v)); $v = strtolower($v); $value = $$v ? $this->_('supported') : $this->_('not supported'); $status = $$v ? self::$ok : self::$fail; #$results['images'][] = array( $results[] = array( 'title' => $name, 'value' => $value, 'status' => $status, 'action' => '' ); } } // check if we can read exif data $res = function_exists('exif_read_data'); $action = $res ? '' : $this->_("This is not needed for ProcessWire core, but maybe needed with third party modules"); #$results['images'][] = array( $results[] = array( 'title' => $this->_('Exif read data'), 'value' => $res ? $this->_('available') : $this->_('not available'), 'status' => $res ? self::$ok : self::$warn, 'action' => $action ); // check if Imagick is supported if(!class_exists('Imagick')) { #$results['images'][] = array( $results[] = array( 'title' => $this->_('Imagick Extension'), 'value' => 'not available', 'status' => self::$warn, 'action' => $this->_('This is not needed for ProcessWire core, but maybe needed with third party modules') ); } else { if(self::isDisabled('phpinfo')) { #$results['images'][] = array( $results[] = array( 'title' => $this->_('Imagick Extension'), 'value' => 'is available', 'status' => self::$warn, 'action' => $this->_('Odd, retrieving phpinfo on your server is disabled! We cannot get further informations here.') ); } else { #$results['images'][] = array( $results[] = array( 'title' => $this->_('Imagick Extension'), 'value' => 'available', 'status' => self::$ok, 'action' => '' ); ob_start(); phpinfo(); $buffer = ob_get_clean(); $pattern = '/>imagick<.*?<table.*?(<tr>.*?<\/table>)/msi'; preg_match($pattern, $buffer, $matches); if(isset($matches[1])) { $buf = trim(str_replace('</table>', '', $matches[1])); $a = explode("\n", strip_tags(str_replace(array("\r\n", "\r", '</td><td'), array("\n", "\n", '</td>###<td'), $buf))); $info = array(); foreach($a as $line) { if(preg_match('/ImageMagick supported formats/i', $line)) continue; $tmp = explode('###', $line); $k = trim($tmp[0], ': '); $v = str_replace(' http://www.imagemagick.org', '', trim($tmp[1])); #$results['images'][] = array( $results[] = array( 'title' => $k, 'value' => $v, 'status' => self::$ok, 'action' => '' ); } } } } return $results; }
  8. Yes it sounds confusing You have nothing said from repeaters. Why do you use them? I have thought you just use fileInputfields? (Would be much easier!) So, anyways, lets have some looks, but step by step: What exactly is $page->logos? A repeaterfield? What fields / fieldtypes has it bundled? (name = type) I'm not sure with this. What does it output your $logo->id? Differend ids? just use for debugging something like: <?php foreach($page->logos as $logo) { echo "<p>{$config->urls->root}download.php?pageid={$logo->id}&file={$logo->logo_file}</p>"; } ?> Please post a few lines of its output here. After that we will go on.
  9. What is your actually setup? Where do you upload your files? On which page(s) do you create these links?
  10. Also it could be good to add some or many (?) checks into it that are normally run with the installer? This could be very useful when people just ftp-ing their site-profile from dev to live and send a mysql_dump along the same way.
  11. @Steve, for what is the parent::init() parent::install() in the install routine? When I try to install the module my server (apache windows) crashes and after reloading the browserpage I have the module installed but not the Diagnostics Page created. I haven't investigated much further, but the code where it comes to the interrupt is not in your module, but is it needed / common usage to do the call for parent::install? Also if it is common, if something break like in my situation, the uninstall routine of your module (and every other module where this happens) is affected when it try to delete a page that wasn't created. Would it be better to check if $p->id > 0 before trying to delete, and in the init() or ready() if the Diagnostics Page exists? --- Another one I have from @adrian: on some servers the phpinfo() could be disabled, therefor a check for it would be good. I have forgotten to implement it in my previously posted code: /** * returns if function is disabled in php * * @return boolean: true, false */ static protected function isDisabled($function) { $disabled_functions = explode(',' , str_replace(' ', '', strtolower(ini_get('disable_functions')))); return in_array(strtolower($function), $disabled_functions); }
  12. @Steve: maybe sooner or later it would be good to group the diagnostics ( $results['group_name'][] = ...), what do you think? Here is a snippet for php version that has max memory and system info. Take from it what you think is useful. I will provide one other for images stuff. protected function getPhpDiagnostics() { $ver = null; // string PHP Version $mem = null; // string Max Memory for PHP $api = null; // string full api info $sys = null; // string full sys info ob_start(); phpinfo(INFO_GENERAL); $buffer = str_replace("\r\n", "\n", ob_get_contents()); ob_end_clean(); $ver = phpversion(); $mem = trim(ini_get('memory_limit')); $pattern = preg_match('#</td>#msi', $buffer)===1 ? '#>Server API.*?</td><td.*?>(.*?)</td>#msi' : '#\nServer API.*?=>(.*?)\n#msi'; $api = preg_match($pattern, $buffer, $matches)===1 ? trim($matches[1]) : null; $pattern = preg_match('#</td>#msi', $buffer)===1 ? '#>System.*?</td><td.*?>(.*?)</td>#msi' : '#\nSystem.*?=>(.*?)\n#msi'; $sys = preg_match($pattern, $buffer, $matches)===1 ? trim($matches[1]) : null; // build results array version $pwver = $this->config->version; $php53 = version_compare($ver, '5.3.8', '>='); if(!$php53) { $res = version_compare($pw, '2.4.0', '<'); // I don't know which is the last PW version that can run with 5.2.x $action = $res ? '' : $this->_('Explanation of any problem or action needed to correct.'); } else { $res = true; $action = $this->_(sprintf('running ProcessWire %s with PHP %s is fine', $pwver, $ver)); } $results['php'][] = array( 'title' => $this->_('PHP Version'), 'value' => $ver, 'status' => $res ? $this->_('Ok') : $this->_('Fail'), 'action' => $action ); // build results array PHP Handler $res = true; $action = ''; $results['php'][] = array( 'title' => $this->_('PHP Handler'), 'value' => $api, 'status' => $res ? $this->_('Ok') : $this->_('Fail'), 'action' => $action ); // build results array PHP max memory $res = true; $action = ''; $results['php'][] = array( 'title' => $this->_('PHP max Memory'), 'value' => $mem, 'status' => $res ? $this->_('Ok') : $this->_('Fail'), 'action' => $action ); // build results array PHP system info $res = true; $action = ''; $results['php'][] = array( 'title' => $this->_('System Information'), 'value' => $sys, 'status' => $res ? $this->_('Ok') : $this->_('Fail'), 'action' => $action ); return $results; }
  13. sorry, I answer very short because I'm on the run ;-) // you need to use bootstrapped code $user-> versus wire('user')-> $pages-> versus wire('pages')-> etc. And also: $filepath = $config->path->files . wire('pages')->get( ?? which page ?? ); You need to send the ID of the page you refer to: <?php $url = $config->urls->root . 'download.php'; $url .= '?pageid=' . $page->id . '&file=' . $logo->logo_file->name; ?> <a href="<?php echo $url ?>">Download file</a> You can read more about including / bootstrapping pw here: http://processwire.com/api/include/
  14. Reminder: This is not a political forum, it is dev-talk. It is fairly ok I think if there is some (little) drift sometimes, but the focus should be on LITTLE.
  15. @Alxndre': as far as I know, the (old) SiteExport-Profile in the modules directory still works with PW 2.4.0, but only for sites that do not use multilanguage fields. (and it does not export users / roles )
  16. Wow. There is also a module out: https://github.com/netcarver/PW-ProcessFieldChangeNotifier
  17. Now that it seems to be that simple to convert from WP to PW, I'm a bit sad that I don't have any WP site.
  18. Here is a snippet that I have used to quickly determine changes of defined fields: public function getModifiedStamps($tablenames) { $tablenameDefaults = array('field_title', 'field_headline', 'field_somename'); $tablenames = array_merge($tablenameDefaults, $tablenames); $stamps = array(); foreach($tablenames as $tablename) { $r = wire('db')->query("SHOW TABLE STATUS LIKE '$tablename'"); $row = $r->fetch_assoc(); $stamps[$tablename] = strtotime($row['Update_time']); #$stamps['s_'.$tablename] = date('d.m.Y H:i:s', strtotime($row['Update_time'])); }
  19. Sounds good! I've bookmarked this post for later use / remembering.
  20. clarifying: The buggy GD lib is in PHP 5.5.9 and 5.5.10, not in PW. But after we have noticed that those buggy PHP versions out, we have added a fix to PW. --- It would be good to have a system like you mentioned, but actually I cannot understand how this should function. I don't think that it is practical to request a page with every PW pageload if debug is true. (to much traffic) It could be something in the admin, a link that one could click manually, once a problem was encountered. Also I have thought of a little module that can assist with things like this by collecting server information for the user.
  21. This has a buggy GD library. You have a PW version 2.4.1 ?? If so, you should try it with the latest dev version of PW, 2.4.2. This has a fix in it. >> https://github.com/ryancramerdesign/ProcessWire/pull/436 and here: https://github.com/ryancramerdesign/ProcessWire/pull/440
  22. PHP 5.5.9 or 5.5.10 ?? Or what version is this running on?
  23. Yes, if you have created the a role for press, you must assign him to it! I have explained an approach without a special role "press", just with a user. But it is pretty fine to use a role.
×
×
  • Create New...