Services_Twitter_r302262.diff
7904 byte
[md5] 89930ad5cf340af7a101ed74261d4a34
修正
sendOAuthRequest()メソッドでHTTP_OAuth_Exceptionがthrowされる問題
serchメソッドでhttp://search.twitter.comを利用しない問題
blocks/createメソッドでuser_id、screen_nameを指定できない問題
blocks/destroyメソッドでuser_id、screen_nameを指定できない問題
テストでOAuthの場合sourceはアプリケーションになる問題
テストでutf8テストが二重投稿になる問題
テストでOAuthの場合オブジェクトがHTTP_OAuth_Consumer_Responseになる問題
追加
blocks/bloking/idsメソッド (call $t->blocks->blocking_ids())
$ svn export -r 302262 http://svn.php.net/repository/pear/packages/Services_Twitter/trunk Services_Twitter
$ wget http://blog.cheki.net/Services_Twitter_r302262.diff
$ cd Services_Twitter
$ patch -p0 < ../services_twitter.diff
patching file Services/Twitter.php
patching file data/api.xml
patching file tests/900-exceptions.phpt
patching file tests/910-options.phpt
patching file tests/920-utf8.phpt
patching file tests/data/utf8-2.dat
patching file tests/setup.php
公開鍵を作成し設定する
Help.GitHub – Generating SSH keys (Win/msysgit)
ユーザー名、アクセストークンの設定をする
$ git config --global github.user username
$ git config --global github.token xxxxxxxxxxxxxxxxxxxxxx
接続を試してみる。
$ ssh git@github.com
ERROR: Hi username! You've successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
successfully authenticatedのメッセージが帰ってくればOK
あとはgithubでリポジトリを作成すると、commitの仕方が表示されます。
Services_Twitter
以前パッチが取り込まれたけど、Basic認証でしか確認してなくて、OAuthだとDELETEメソッドで問題がでてました。
その他なんか迷走してる感じだったので、パッチ送りたいなとPEARアカウントを取得しようと申請したのですがレスポンスがないので、とりあえずgithubにぶち込んだ次第です。
バグレポートもパッチ投げるにもPEARアカウントないと半匿名な感じになるので。
cockok's Services_Twitter at master – GitHub
リリース最新は0.6.2ですが、trunkが変更されてたのでそちらをfork。
あいきゃんとすぴーくいんぐりっしゅ。
もちろん書くのも。
ちなみに、DELETEメソッドででる問題は、RFC2616に以下のようなところ。
The DELETE method requests that the origin server delete the resource identified by the Request-URI.
HTTP/1.1: Method Definitions
こっちはPEAR::HTTP_OAuthの問題。
at, batch, atq, atrm – 後で実行するコマンドジョブをキューに入れたり、そのようなジョブの閲覧・削除を行なう
Manpage of AT
test.shを1分後に実行
$ at -f ./test.sh now 1minute
test.shを13:00に実行
$ at -f ./test.sh 13:00
パイプでつないで
$ echo './test.sh' | at now 1minute
シェルから
はCtrl+D
$ at now + 1minute
warning: commands will be executed using /bin/sh
at> './test.sh'
at>
job 11 at Wed Aug 11 13:12:00 2010
実行されていないジョブ一覧
$ atq
実行されていないジョブの削除
atqでジョブIDを取得して指定
$ atq
1 Wed Aug 11 13:00:00 2010 a cockok
$ atrm 1
Manual :: 共有ホストでの PEAR のローカルコピーのインストール
既にpearコマンドが利用可能な場合。
$ pear config-create /path/to ~/.pearrc
/path/to/pear以下に諸々配置される設定ファイルが~/.pearrcとして作成される。
この場合、PEARディレクトリは/path/to/pear/phpとなる。
ディレクトリ等、設定をを変更したい場合は、通常通りpear config-setコマンドで。
phpコマンドを実行する際にinclude_pathの設定をしたいが、オプションでは指定できないので、php.iniを別途準備し読むように指定するaliasを設定。
$ cp /etc/php.ini /path/to
$ vim /path/to/php.ini
$ alias php='php -c /path/to/php.ini'
php.iniのinclude_pathの設定は以下のようにローカルのPEARディレクトリしか読み込まない、または、優先的に読み込むように設定。
include_path = ".:/path/to/php"
#include_path = ".:/path/to/php:/usr/share/pear:/usr/share/php"
まさに誰得。
ブラウザベースは情報いっぱいあったんだけど、クライアントベースが見つからなかったので。
取得したaccess_token、access_token_secretを利用の仕方は下記で。
PEAR::HTTP_OAuthでxAuth – ぱんぴーまっしぐら
#!/usr/bin/env php
<?php
require_once 'HTTP/OAuth/Consumer.php';
define('CONSUMER_KEY', 'xxxxxxxxxxxxxxxxxxxx');
define('CONSUMER_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
try {
$http_request = new HTTP_Request2();
$http_request->setConfig('ssl_verify_peer', false);
$consumer_request = new HTTP_OAuth_Consumer_Request();
$consumer_request->accept($http_request);
$consumer = new HTTP_OAuth_Consumer(CONSUMER_KEY, CONSUMER_SECRET);
$consumer->accept($consumer_request);
$consumer->getRequestToken('http://twitter.com/oauth/request_token');
$url = $consumer->getAuthorizeUrl('http://twitter.com/oauth/authorize');
if (!$stdin = fopen('php://stdin', 'r')) {
throw new Exception('stdin open failed');
}
echo 'Visit the following URL in your browser to authenticate twitter: ';
echo $url."\n";
echo 'Enter Twitter OAuth PIN: ';
$pin = trim(fgets($stdin, 64));
$consumer->getAccessToken('http://twitter.com/oauth/access_token', $pin);
echo 'access_token: '.$consumer->getToken()."\n";
echo 'access_token_secret: '.$consumer->getTokenSecret()."\n";
} catch (Exception $e) {
echo $e->getMessage().' in '.$e->getFile().' line '.$e->getLine()."\n";
exit(1);
}
RSS Subscription Extension(by Google) – Google Chrome 拡張機能ギャラリー
FirefoxのようにChromeでも簡単にRSSを登録できるようになる拡張機能
オプションからlivedoor Readerを追加
説明:「livedoor Reader」
URL:「http://reader.livedoor.com/subscribe/%s」
logrotateは、ローテーションの設定をするconfファイルと、ローテーションの状態を保存するstatusファイルが必要になる。
標準ではroot権限で実行されているので、ユーザー権限でstatusファイルへのアクセス権限がなく、別途用意する必要がある。
/path/to/access_logを1日ごとにローテーション、履歴は7つまで保存する。
confファイルは/home/hoge/etc/logrotate.conf
/path/to/access_log {
daily
missingok
rotate 7
}
statusファイルは/home/hoge/lib/logrotate.status
テスト
$ /usr/sbin/logrotate -d -s /home/hoge/lib/logrotate.status /home/hoge/etc/logrotate.conf
実行
$ /usr/sbin/logrotate -s /home/hoge/lib/logrotate.status /home/hoge/etc/logrotate.conf
cronへの追加
$ crontab -e
0 4 * * * /usr/sbin/logrotate -s /home/hoge/lib/logrotate.status /home/hoge/etc/logrotate.conf
via:logrotate
Manual :: コードの提供にあたっての要求事項
インストール
# yum --enablerepo=remi,epel install php-pear-PHP-CodeSniffer
使い方
$ phpcs hoge.php