| @@ 1726-1763 (lines=38) @@ | ||
| 1723 | return $stats; |
|
| 1724 | } |
|
| 1725 | ||
| 1726 | function elgg_solr_get_log_line($filename) { |
|
| 1727 | $line = false; |
|
| 1728 | $f = false; |
|
| 1729 | if (file_exists($filename)) { |
|
| 1730 | $f = @fopen($filename, 'r'); |
|
| 1731 | } |
|
| 1732 | ||
| 1733 | if ($f === false) { |
|
| 1734 | return false; |
|
| 1735 | } else { |
|
| 1736 | $cursor = -1; |
|
| 1737 | ||
| 1738 | fseek($f, $cursor, SEEK_END); |
|
| 1739 | $char = fgetc($f); |
|
| 1740 | ||
| 1741 | /** |
|
| 1742 | * Trim trailing newline chars of the file |
|
| 1743 | */ |
|
| 1744 | while ($char === "\n" || $char === "\r") { |
|
| 1745 | fseek($f, $cursor--, SEEK_END); |
|
| 1746 | $char = fgetc($f); |
|
| 1747 | } |
|
| 1748 | ||
| 1749 | /** |
|
| 1750 | * Read until the start of file or first newline char |
|
| 1751 | */ |
|
| 1752 | while ($char !== false && $char !== "\n" && $char !== "\r") { |
|
| 1753 | /** |
|
| 1754 | * Prepend the new char |
|
| 1755 | */ |
|
| 1756 | $line = $char . $line; |
|
| 1757 | fseek($f, $cursor--, SEEK_END); |
|
| 1758 | $char = fgetc($f); |
|
| 1759 | } |
|
| 1760 | } |
|
| 1761 | ||
| 1762 | return $line; |
|
| 1763 | } |
|
| 1764 | ||
| 1765 | ||
| 1766 | function elgg_solr_get_cores() { |
|
| @@ 669-706 (lines=38) @@ | ||
| 666 | return 'en'; |
|
| 667 | } |
|
| 668 | ||
| 669 | function tidypics_get_last_log_line($filename) { |
|
| 670 | $line = false; |
|
| 671 | $f = false; |
|
| 672 | if (file_exists($filename)) { |
|
| 673 | $f = @fopen($filename, 'r'); |
|
| 674 | } |
|
| 675 | ||
| 676 | if ($f === false) { |
|
| 677 | return false; |
|
| 678 | } else { |
|
| 679 | $cursor = -1; |
|
| 680 | ||
| 681 | fseek($f, $cursor, SEEK_END); |
|
| 682 | $char = fgetc($f); |
|
| 683 | ||
| 684 | /** |
|
| 685 | * Trim trailing newline chars of the file |
|
| 686 | */ |
|
| 687 | while ($char === "\n" || $char === "\r") { |
|
| 688 | fseek($f, $cursor--, SEEK_END); |
|
| 689 | $char = fgetc($f); |
|
| 690 | } |
|
| 691 | ||
| 692 | /** |
|
| 693 | * Read until the start of file or first newline char |
|
| 694 | */ |
|
| 695 | while ($char !== false && $char !== "\n" && $char !== "\r") { |
|
| 696 | /** |
|
| 697 | * Prepend the new char |
|
| 698 | */ |
|
| 699 | $line = $char . $line; |
|
| 700 | fseek($f, $cursor--, SEEK_END); |
|
| 701 | $char = fgetc($f); |
|
| 702 | } |
|
| 703 | } |
|
| 704 | ||
| 705 | return $line; |
|
| 706 | } |
|
| 707 | ||
| 708 | function tidypics_get_log_location($time) { |
|
| 709 | return elgg_get_config('dataroot') . 'tidypics_log' . '/' . $time . '.txt'; |
|