Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. GREETING: I would like to wish everyone at W3Schools a very Happy New Year! BACKGROUND: In an effort to speed up Matomo's performance without having to create a routine that will retrieve, save, and call the desire data -- a procedure suggested earlier by others -- I am seeking to set up a Matomo CRON job that apparently does the same with no additional coding on my part. Unfortunately, I am confused by the syntax. CODE (RECOMMENDED BY MATOMO): 5 * * * * www-data /usr/bin/php5 /path/to/piwik/console core:archive --url=http://example.org/piwik/ > /home/example/piwik-archive.log QUESTION: To what refers the phrase core:archive in the above code segment? NOTE: Within the path/to/piwik folder there exists a document file called console. Within the path/to/piwik/core folder there exists a file called Console.php, a folder called Archive, and a file called Archive.php. There are various files in the Archive folder, but none of them resemble very closely any of the folders and files just mentioned. Roddy
  2. In most languages individual words can be sought and found because all words in a text are separated by blank spaces. For example, I have no trouble performing search and find operations for Arabic, Korean, or English. Chinese and Japanese words, however, are not separated by blank spaces and are impossible, as a result, to distinguish from their neighbors. The ngram and mecab parsers do not depend on blank spaces to perform their search, rather they search according to the number of bytes that typically make up Japanese and Chinese words: one, two, three, four, and at most five characters, generally speaking. One and two character words are the more common. The word 日本語 (Japanese language) is returned because it appears with a space before and after. The word 本質, however, is surrounded by text on either side. It is not delimited by spaces. Now, I just performed the additional MySQL command and discovered the following: SHOW STATUS LIKE 'mecab_charset'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | mecab_charset | utf8 | +---------------+-------+ 1 row in set (0.03 sec) This is additional proof that there is nothing wrong with my installation. My intuition suggests that the problem may lie with the DEFAULT CHARSET of my data table that is set to Latin. This said, changing the character set of a table can be problematic, and the columns themselves are correctly set to UTF-8. Thus, before proceeding I would like to ascertain the character set requirements for the InnoDB MySQL table when using the mecab parser. This, however, I have been unable to find. Roddy
  3. I have just run TEST THREE above in the MySQL console. It produces the same result as in the SQL menu of phpMyAdmin. mysql> SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC; Empty set (0.68 sec) This would explain why, in part, that no complaint is received from either PHP or MySQL, everything appears to be running fine -- simply it is not. Roddy p.s. As far as the character code is concerned the table is set to Latin, but the columns/fields in the table that are being search are set to UTF-8.
  4. The code that I ran with phpMyAdmin and the code that I run with PHP when I make AJAX calls are the same. Simply, I had to substitute the ? mark with an actual term and was compelled to enter the quotation marks manually. Roddy
  5. Thank you for the suggestion. This is what I discovered. The ORIGINAL SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC TEST ONE: Insert a Japanese word that requires use of the Mecab parser to parse. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (本質 IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (本質 IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT ONE: Error - The Japanese word is recognized as an unidentified field or column. TEST TWO: Insert the same Japanese word delimited with single quotation marks. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ('本質' IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ('本質' IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT TWO: No error is generated. Neither, however, is a match found. TEST THREE: Insert the same Japanese word delimited with double quotation marks. SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST ("本質" IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC RESULT THREE: No error is generated. Neither, however, is a match found. Please advise further. Roddy
  6. 0 down vote favorite BACKGROUND: I have built a custom search engine that works fine in English, but fails in Japanese, this despite confirmation from my host server that I have performed the installation of the Japanese mecab parser correctly. My own checks reveal the following: 1) SHOW CREATE TABLE: FULLTEXT KEY search_newsletter (letter_title, letter_abstract, letter_body) /*!50100 WITH PARSER mecab */ ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 2) SHOW PLUGINS: ngram | ACTIVE | FTPARSER | NULL | GPL | mecab | ACTIVE | FTPARSER | libpluginmecab.so | GPL IMPLEMENTATION 1) MYSQL Statement: $sql ="SELECT letter_no, letter_lang, letter_title, letter_abstract, submission_date, revision_date, MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) AS letter_score FROM sevengates_letter WHERE MATCH (letter_title, letter_abstract, letter_body) AGAINST (? IN NATURAL LANGUAGE MODE) ORDER BY letter_score DESC"; 2) CUSTOM SEARCH ENGINE: See under Local Search / Newsletters at https://www.grammarcaptive.com/overview.html 3) DOCUMENT SEARCHED: See under Regular Updates / Newsletter / Archives / Japanese at https://www.grammarcaptive.com/overview.html COMMENT: Neither PHP, nor MySQL complains. Simply any Japanese word search that needs to be parsed is not returned. For example, the word 日本語 can be search and found, but does not require any parsing to be retrieved. The search for any other Japanese word in the newsletter fails. REQUEST: Any troubleshooting tips would be greatly appreciated. Roddy
  7. Dsonesuk: I am not sure that I understand what you are recommending. Is it Create a div and a function on the current page that is triggered when this div is clicked. Load with this click only that portion of the page to which the current page links and contains the link whose normal functioning I wish to suppress and replace with some other function. Activate this some-other-function. If it is not, please elaborate further. If it is, please confirm. Roddy
  8. The reason for this assumption is that I have run into a lot of junk in my brief two years of coding. In any case, the problem has been resolved by resetting the PHP bin path for my server's CRONTAB. Further, my first scheduled email using Peppe Occhi's CRON Scheduler has been received along with the output for my newly installed CRON Scheduler CRON job. Finally, a credit on the Grammar Captive webpage has been posted for both Peppe Occhi and Symphony under the headings CRON Scheduler and SwiftMailer in the CREDITS section of the Grammar Captive mainpage. Hooray! Hooray! Once again, thank you W3Schools. Roddy
  9. No, I did not look up the operator, for it made no sense. What did make sense was a typo. Then, I looked at the surrounding code and tried to understand what was going on. After which I played with it until I found something that made sense and PHP no longer complained. I made a dozen other similar corrections on a variety of pages before I finally stumbled with PHP rejecting its own CORE function. Roddy
  10. $this->addressEncoder = !empty($addressEncoder) ? $addressEncoder : new Swift_AddressEncoder_IdnAddressEncoder(); This is exactly what I did do and moved onto the next error and correction, but before going any further let us wait until I have clarified with my host provider why all of my CRONTAB jobs are pointed to 5.6 and my default and domain settings are pointing to 7.2. This now appears to be the likely source of the problem, for after all, the scheduler.php that I set up depends on the CRONTAB for its existence. Roddy
  11. OK. I had lunch in between, but here it is: the first reported error. public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null) { $this->buffer = $buf; $this->eventDispatcher = $dispatcher; $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder(); $this->setLocalDomain($localDomain); } The line indicated by PHP as the source of error. $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder(); If you need the error message, here is that as well. [19-Nov-2018 21:38:02 UTC] PHP Parse error: syntax error, unexpected '?' in /home/thege0/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 53 Roddy p.s. The software was downloaded and installed with no version requirement using the following command. If I remember correctly, in the absence of a version number Composer provides automatically the most recent stable version. [...@vps ~]$ php composer.phar require swiftmailer/swiftmailer
  12. With your and Ingolme's insistence that the problem lies with the PHP version I have performed a little exploration and discovered that the bin folder path to the PHP binary file for my CRONTAB is set to PHP 5.6 and not to PHP 7.2 as are my primary domain and each of my add-on domains that employ PHP. I have notified my webserver host in regard to this inconsistency and am waiting for their reply. You see, Swiftmailer is used by CRON Scheduler to deliver notification about the successful execution of CRON jobs. Is it not likely then that the same version of PHP is used to run both pieces of software? In any case, I have already removed Swiftmailer and am in the process of reinstalling it. Further, changing the version of PHP should have no effect on the defective PHP code that I was compelled to modify in order to get SwiftMailer to even execute up to the point where the random_bytes( ) CORE function was needed. Hopefully, I will be back in a short while with the first problematic piece of SwiftMailer code. Roddy
  13. I have an easier and perhaps more informative way of achieving the same: [...@vps ~]$ php -v ea-php-cli Copyright 2017 cPanel, Inc. PHP 7.2.12 (cli) (built: Nov 13 2018 21:12:16) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies Roddy
  14. OK. I will uninstall and reinstall the software. However, rather than editing the software as I did before and thereby removing each and every fatal error that I encountered until PHP told that a PHP CORE function does not work. I will let the mentorship of W3Schools have a look at the code and error first. Indeed, what I expected to hear from y'all, I did not -- namely, that the PHP error regarding the random_bytes() function is not the true source of the error, and that something in the preceding line of code is triggering it -- say a call to a faulty class that I had perhaps created during one of my many edits. I am looking forward to a very interesting and perhaps even enlightening week with W3Schools for all concerned. Roddy
  15. The syntax errors that I showed you have been corrected file after file after file. Were I to retrace the errors I would have to reinstall the software and start all over again. It were as if the authors were trying to show the painstaking work that they went through to create the software, or alternatively all of the different ways that it could be adapted to specific needs. This is what I meant when I said it is software designed for professionals. Roddy
  16. BACKGROUND: I have a page with a link whose normal behavior is suppressed in order to make room for a script that produces a gallery of frames when the new page opens. The LINK <div class="moji"> <a id='hito_rireki' onclick="return false;" href="Emblem/hito.html"> <img src="Emblem/_Images/to.gif" width="105" height="90" alt="(人という文字) The Sino-Japanese Character for Person" title="クリックして下さい!" /> </a> </div> QUESTION: Is there a way to trigger this same link from a completely different page that does not involve the use of a GET or POST HTTPRequest? Roddy
  17. Great! Now please pass your cursor over the heart and click on the trophy to say thanks! I hope that it was because of me that you were able to achieve your goal. Roddy
  18. Ingolme: My, my! Who bit you and why? You need to find out, for it was not me. The version of PHP that I am using to run SwiftMailer, and that I installed with Composer is 7.2. What is more, I said that I researched both the bin2hex( ) and random_bytes( ) functions before I posted. Now, although it is true that I am running locally at PHP 5+, SwiftMailer is not installed on my machine. Any other ideas? Roddy p.s. Here are just two of the many syntax errors that I can easily remember having corrected. function ( ... ) : string { ... } and $variable = ??;
  19. BACKGROUND: I have never experienced anything like it. It were as if the authors purposely sabotaged their software for non-professionals. I have now edited close to a dozen files removing extraneous code with each new fatal error. Finally, however, I have come across a failure that baffles me. DISCUSSION: Line 90 of the error message (see below) is the first line of code of the class's construct function -- namely, $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values Now, I have researched both the bin2hex() and random_bytes() function, and I can discover nothing amiss with the implementation of either. The problem appears to lie elsewhere. But, where to look? The ERROR: The FILE: <?php /* * This file is part of SwiftMailer. * (c) 2004-2009 Chris Corbyn * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * A MIME entity, in a multipart message. * * @author Chris Corbyn */ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver { /** Main message document; there can only be one of these */ const LEVEL_TOP = 16; /** An entity which nests with the same precedence as an attachment */ const LEVEL_MIXED = 256; /** An entity which nests with the same precedence as a mime part */ const LEVEL_ALTERNATIVE = 4096; /** An entity which nests with the same precedence as embedded content */ const LEVEL_RELATED = 65536; /** A collection of Headers for this mime entity */ private $headers; /** The body as a string, or a stream */ private $body; /** The encoder that encodes the body into a streamable format */ private $encoder; /** Message ID generator */ private $idGenerator; /** A mime boundary, if any is used */ private $boundary; /** Mime types to be used based on the nesting level */ private $compositeRanges = [ 'multipart/mixed' => [self::LEVEL_TOP, self::LEVEL_MIXED], 'multipart/alternative' => [self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE], 'multipart/related' => [self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED], ]; /** A set of filter rules to define what level an entity should be nested at */ private $compoundLevelFilters = []; /** The nesting level of this entity */ private $nestingLevel = self::LEVEL_ALTERNATIVE; /** A KeyCache instance used during encoding and streaming */ private $cache; /** Direct descendants of this entity */ private $immediateChildren = []; /** All descendants of this entity */ private $children = []; /** The maximum line length of the body of this entity */ private $maxLineLength = 78; /** The order in which alternative mime types should appear */ private $alternativePartOrder = [ 'text/plain' => 1, 'text/html' => 2, 'multipart/related' => 3, ]; /** The CID of this entity */ private $id; /** The key used for accessing the cache */ private $cacheKey; protected $userContentType; /** * Create a new SimpleMimeEntity with $headers, $encoder and $cache. */ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator) { $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values $this->cache = $cache; $this->headers = $headers; $this->idGenerator = $idGenerator; $this->setEncoder($encoder); $this->headers->defineOrdering(['Content-Type', 'Content-Transfer-Encoding']); // This array specifies that, when the entire MIME document contains // $compoundLevel, then for each child within $level, if its Content-Type // is $contentType then it should be treated as if it's level is // $neededLevel instead. I tried to write that unambiguously! :-\ // Data Structure: // array ( // $compoundLevel => array( // $level => array( // $contentType => $neededLevel // ) // ) // ) $this->compoundLevelFilters = [ (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => [ self::LEVEL_ALTERNATIVE => [ 'text/plain' => self::LEVEL_ALTERNATIVE, 'text/html' => self::LEVEL_RELATED, ], ], ]; $this->id = $this->idGenerator->generateId(); } /** * Generate a new Content-ID or Message-ID for this MIME entity. * * @return string */ public function generateId() { $this->setId($this->idGenerator->generateId()); return $this->id; } /** * Get the {@link Swift_Mime_SimpleHeaderSet} for this entity. * * @return Swift_Mime_SimpleHeaderSet */ public function getHeaders() { return $this->headers; } /** * Get the nesting level of this entity. * * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE * * @return int */ public function getNestingLevel() { return $this->nestingLevel; } /** * Get the Content-type of this entity. * * @return string */ public function getContentType() { return $this->getHeaderFieldModel('Content-Type'); } /** * Get the Body Content-type of this entity. * * @return string */ public function getBodyContentType() { return $this->userContentType; } /** * Set the Content-type of this entity. * * @param string $type * * @return $this */ public function setContentType($type) { $this->setContentTypeInHeaders($type); // Keep track of the value so that if the content-type changes automatically // due to added child entities, it can be restored if they are later removed $this->userContentType = $type; return $this; } /** * Get the CID of this entity. * * The CID will only be present in headers if a Content-ID header is present. * * @return string */ public function getId() { $tmp = (array) $this->getHeaderFieldModel($this->getIdField()); return $this->headers->has($this->getIdField()) ? current($tmp) : $this->id; } /** * Set the CID of this entity. * * @param string $id * * @return $this */ public function setId($id) { if (!$this->setHeaderFieldModel($this->getIdField(), $id)) { $this->headers->addIdHeader($this->getIdField(), $id); } $this->id = $id; return $this; } /** * Get the description of this entity. * * This value comes from the Content-Description header if set. * * @return string */ public function getDescription() { return $this->getHeaderFieldModel('Content-Description'); } /** * Set the description of this entity. * * This method sets a value in the Content-ID header. * * @param string $description * * @return $this */ public function setDescription($description) { if (!$this->setHeaderFieldModel('Content-Description', $description)) { $this->headers->addTextHeader('Content-Description', $description); } return $this; } /** * Get the maximum line length of the body of this entity. * * @return int */ public function getMaxLineLength() { return $this->maxLineLength; } /** * Set the maximum line length of lines in this body. * * Though not enforced by the library, lines should not exceed 1000 chars. * * @param int $length * * @return $this */ public function setMaxLineLength($length) { $this->maxLineLength = $length; return $this; } /** * Get all children added to this entity. * * @return Swift_Mime_SimpleMimeEntity[] */ public function getChildren() { return $this->children; } /** * Set all children of this entity. * * @param Swift_Mime_SimpleMimeEntity[] $children * @param int $compoundLevel For internal use only * * @return $this */ public function setChildren(array $children, $compoundLevel = null) { // TODO: Try to refactor this logic $compoundLevel = $compoundLevel ? $this->getCompoundLevel($children) : $immediateChildren = []; $grandchildren = []; $newContentType = $this->userContentType; foreach ($children as $child) { $level = $this->getNeededChildLevel($child, $compoundLevel); if (empty($immediateChildren)) { //first iteration $immediateChildren = [$child]; } else { $nextLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel); if ($nextLevel == $level) { $immediateChildren[] = $child; } elseif ($level < $nextLevel) { // Re-assign immediateChildren to grandchildren $grandchildren = array_merge($grandchildren, $immediateChildren); // Set new children $immediateChildren = [$child]; } else { $grandchildren[] = $child; } } } if ($immediateChildren) { $lowestLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel); // Determine which composite media type is needed to accommodate the // immediate children foreach ($this->compositeRanges as $mediaType => $range) { if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) { $newContentType = $mediaType; break; } } // Put any grandchildren in a subpart if (!empty($grandchildren)) { $subentity = $this->createChild(); $subentity->setNestingLevel($lowestLevel); $subentity->setChildren($grandchildren, $compoundLevel); array_unshift($immediateChildren, $subentity); } } $this->immediateChildren = $immediateChildren; $this->children = $children; $this->setContentTypeInHeaders($newContentType); $this->fixHeaders(); $this->sortChildren(); return $this; } /** * Get the body of this entity as a string. * * @return string */ public function getBody() { return $this->body instanceof Swift_OutputByteStream ? $this->readStream($this->body) : $this->body; } /** * Set the body of this entity, either as a string, or as an instance of * {@link Swift_OutputByteStream}. * * @param mixed $body * @param string $contentType optional * * @return $this */ public function setBody($body, $contentType = null) { if ($body !== $this->body) { $this->clearCache(); } $this->body = $body; if (null !== $contentType) { $this->setContentType($contentType); } return $this; } /** * Get the encoder used for the body of this entity. * * @return Swift_Mime_ContentEncoder */ public function getEncoder() { return $this->encoder; } /** * Set the encoder used for the body of this entity. * * @return $this */ public function setEncoder(Swift_Mime_ContentEncoder $encoder) { if ($encoder !== $this->encoder) { $this->clearCache(); } $this->encoder = $encoder; $this->setEncoding($encoder->getName()); $this->notifyEncoderChanged($encoder); return $this; } /** * Get the boundary used to separate children in this entity. * * @return string */ public function getBoundary() { if (!isset($this->boundary)) { $this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_'; } return $this->boundary; } /** * Set the boundary used to separate children in this entity. * * @param string $boundary * * @throws Swift_RfcComplianceException * * @return $this */ public function setBoundary($boundary) { $this->assertValidBoundary($boundary); $this->boundary = $boundary; return $this; } /** * Receive notification that the charset of this entity, or a parent entity * has changed. * * @param string $charset */ public function charsetChanged($charset) { $this->notifyCharsetChanged($charset); } /** * Receive notification that the encoder of this entity or a parent entity * has changed. */ public function encoderChanged(Swift_Mime_ContentEncoder $encoder) { $this->notifyEncoderChanged($encoder); } /** * Get this entire entity as a string. * * @return string */ public function toString() { $string = $this->headers->toString(); $string .= $this->bodyToString(); return $string; } /** * Get this entire entity as a string. * * @return string */ protected function bodyToString() { $string = ''; if (isset($this->body) && empty($this->immediateChildren)) { if ($this->cache->hasKey($this->cacheKey, 'body')) { $body = $this->cache->getString($this->cacheKey, 'body'); } else { $body = "\r\n".$this->encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); $this->cache->setString($this->cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); } $string .= $body; } if (!empty($this->immediateChildren)) { foreach ($this->immediateChildren as $child) { $string .= "\r\n\r\n--".$this->getBoundary()."\r\n"; $string .= $child->toString(); } $string .= "\r\n\r\n--".$this->getBoundary()."--\r\n"; } return $string; } /** * Returns a string representation of this object. * * @see toString() * * @return string */ public function __toString() { return $this->toString(); } /** * Write this entire entity to a {@see Swift_InputByteStream}. */ public function toByteStream(Swift_InputByteStream $is) { $is->write($this->headers->toString()); $is->commit(); $this->bodyToByteStream($is); } /** * Write this entire entity to a {@link Swift_InputByteStream}. */ protected function bodyToByteStream(Swift_InputByteStream $is) { if (empty($this->immediateChildren)) { if (isset($this->body)) { if ($this->cache->hasKey($this->cacheKey, 'body')) { $this->cache->exportToByteStream($this->cacheKey, 'body', $is); } else { $cacheIs = $this->cache->getInputByteStream($this->cacheKey, 'body'); if ($cacheIs) { $is->bind($cacheIs); } $is->write("\r\n"); if ($this->body instanceof Swift_OutputByteStream) { $this->body->setReadPointer(0); $this->encoder->encodeByteStream($this->body, $is, 0, $this->getMaxLineLength()); } else { $is->write($this->encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength())); } if ($cacheIs) { $is->unbind($cacheIs); } } } } if (!empty($this->immediateChildren)) { foreach ($this->immediateChildren as $child) { $is->write("\r\n\r\n--".$this->getBoundary()."\r\n"); $child->toByteStream($is); } $is->write("\r\n\r\n--".$this->getBoundary()."--\r\n"); } } /** * Get the name of the header that provides the ID of this entity. */ protected function getIdField() { return 'Content-ID'; } /** * Get the model data (usually an array or a string) for $field. */ protected function getHeaderFieldModel($field) { if ($this->headers->has($field)) { return $this->headers->get($field)->getFieldBodyModel(); } } /** * Set the model data for $field. */ protected function setHeaderFieldModel($field, $model) { if ($this->headers->has($field)) { $this->headers->get($field)->setFieldBodyModel($model); return true; } return false; } /** * Get the parameter value of $parameter on $field header. */ protected function getHeaderParameter($field, $parameter) { if ($this->headers->has($field)) { return $this->headers->get($field)->getParameter($parameter); } } /** * Set the parameter value of $parameter on $field header. */ protected function setHeaderParameter($field, $parameter, $value) { if ($this->headers->has($field)) { $this->headers->get($field)->setParameter($parameter, $value); return true; } return false; } /** * Re-evaluate what content type and encoding should be used on this entity. */ protected function fixHeaders() { if (count($this->immediateChildren)) { $this->setHeaderParameter('Content-Type', 'boundary', $this->getBoundary() ); $this->headers->remove('Content-Transfer-Encoding'); } else { $this->setHeaderParameter('Content-Type', 'boundary', null); $this->setEncoding($this->encoder->getName()); } } /** * Get the KeyCache used in this entity. * * @return Swift_KeyCache */ protected function getCache() { return $this->cache; } /** * Get the ID generator. * * @return Swift_IdGenerator */ protected function getIdGenerator() { return $this->idGenerator; } /** * Empty the KeyCache for this entity. */ protected function clearCache() { $this->cache->clearKey($this->cacheKey, 'body'); } private function readStream(Swift_OutputByteStream $os) { $string = ''; while (false !== $bytes = $os->read(8192)) { $string .= $bytes; } $os->setReadPointer(0); return $string; } private function setEncoding($encoding) { if (!$this->setHeaderFieldModel('Content-Transfer-Encoding', $encoding)) { $this->headers->addTextHeader('Content-Transfer-Encoding', $encoding); } } private function assertValidBoundary($boundary) { if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) { throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); } } private function setContentTypeInHeaders($type) { if (!$this->setHeaderFieldModel('Content-Type', $type)) { $this->headers->addParameterizedHeader('Content-Type', $type); } } private function setNestingLevel($level) { $this->nestingLevel = $level; } private function getCompoundLevel($children) { $level = 0; foreach ($children as $child) { $level |= $child->getNestingLevel(); } return $level; } private function getNeededChildLevel($child, $compoundLevel) { $filter = []; foreach ($this->compoundLevelFilters as $bitmask => $rules) { if (($compoundLevel & $bitmask) === $bitmask) { $filter = $rules + $filter; } } $realLevel = $child->getNestingLevel(); $lowercaseType = strtolower($child->getContentType()); if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { return $filter[$realLevel][$lowercaseType]; } return $realLevel; } private function createChild() { return new self($this->headers->newInstance(), $this->encoder, $this->cache, $this->idGenerator); } private function notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) { foreach ($this->immediateChildren as $child) { $child->encoderChanged($encoder); } } private function notifyCharsetChanged($charset) { $this->encoder->charsetChanged($charset); $this->headers->charsetChanged($charset); foreach ($this->immediateChildren as $child) { $child->charsetChanged($charset); } } private function sortChildren() { $shouldSort = false; foreach ($this->immediateChildren as $child) { // NOTE: This include alternative parts moved into a related part if (self::LEVEL_ALTERNATIVE == $child->getNestingLevel()) { $shouldSort = true; break; } } // Sort in order of preference, if there is one if ($shouldSort) { // Group the messages by order of preference $sorted = []; foreach ($this->immediateChildren as $child) { $type = $child->getContentType(); $level = array_key_exists($type, $this->alternativePartOrder) ? $this->alternativePartOrder[$type] : max($this->alternativePartOrder) + 1; if (empty($sorted[$level])) { $sorted[$level] = []; } $sorted[$level][] = $child; } ksort($sorted); $this->immediateChildren = array_reduce($sorted, 'array_merge', []); } } /** * Empties it's own contents from the cache. */ public function __destruct() { if ($this->cache instanceof Swift_KeyCache) { $this->cache->clearAll($this->cacheKey); } } /** * Make a deep copy of object. */ public function __clone() { $this->headers = clone $this->headers; $this->encoder = clone $this->encoder; $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values $children = []; foreach ($this->children as $pos => $child) { $children[$pos] = clone $child; } $this->setChildren($children); } } Please advise. Roddy
  20. Yes, it worked! See api_module.php Thanks! Roddy
  21. BACKGROUND: With a mixture of melancholy reluctance and what-else-to-do excitement I have returned to Matomo and managed to extract what appears to be an image. In effect, I am echoing a cUR result set that appears as follows: �PNG IHDR "�E! pHYs���+�IDATx���}�E����ٙ�K6�n ل���DP�FT�_��r���;ėS<���;.���E��D�<5'QP ��o �I��IV6�dC�n6��f6;3}4M���LW������L�Tw��2����J�u]@�L� H�b,�X��#`(F�����v�B۷\�!#`%OWWרo���+�� ... My intuition -- I am sorry, if I can offer little more at this point -- tells me that I could read the contents of this file with the simple addition of a document heading. If so, what might this heading be. If not, what would you suggest? Please advise. Roddy
  22. FOLLOW-UP QUESTION: In light of the above does the following make sense: $matomo_api = new Scheduler(); $matomo_freq = $matomo_api->php('.../fetch_and_store.php','.../bin/ea-php72',['-c' => 'ignore','--merge' => null,],'matomo_api'); $matomo_freq->hourly(); $matomo_api->run(); Roddy
  23. Have you examined the URL carefully? BEFORE YOU CLICK: https://www.wpbeginner.com/beginners-guide/why-you-need-a-cdn-for-your-wordpress-blog-infographic AFTER YOU CLICK https://www.wpbeginner.com/beginners-guide/why-you-need-a-cdn-for-your-wordpress-blog-infographic/?display=wide Notice that a query with a key-value pair has been added. /?display=wide That is a call to PHP code on the same document page that reloads the reloads the page with new content. As no one can see the PHP but the creator and/or webpage host, it is difficult to know how it was achieve. One way, however, might be to use a PHP header() statement and simply reload the page with new content header("Location: https://www.wpbeginner.com/beginners-guide/why-you-need-a-cdn-for-your-wordpress-blog-infographic"); I have never tried to do this before, but others may be able to confirm or disconfirm whether it will work. I, myself, can imagine no objection. Roddy
  24. BACKGROUND: While implementing Peppe Occhi's CRON Scheduler I have come across several lines of code that I am not entirely familiar. In particular I am concerned with the following: $scheduler->php('script.php')->hourly(); found under the heading Schedules execution time. It appears to be of this format $some_instance->some_methodA(arguments)->method_B(arguments); QUESTION: Is the above expression equivalent to the following: $some_instance->some_methodA(arguments); $some_instance->method_B(arguments); In other words, the following is correct: $scheduler->php( 'path_to_folder/script.php', 'path_to_php_version/ea-php72', ['-c' => 'ignore','--merge' => null,], 'file_name' ); $scheduler->hourly(); Please advise. Roddy
  25. Thank you all, but especially Ingolme, for she answered my question in the most thorough manner possible. I am currently testing Peppe Occhi's CRON Scheduler routine and have yet to decide whether I will take Funce's suggestion to pass my results to a database or Dsonesuk's suggestion to write to an XML file. After all this time, I am still not comfortable with the data that I am able to extract from the Matomo data base via its reporting APIs, and more research is still ahead before I can decide how to fetch and store the data on a routine basis. At least now I know better what my options are and how to proceed with them once I have decided. Have a great weekend. Mine will be spent on the internet, as nearly always until I have launched. Roddy
×
×
  • Create New...